Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. How to chage "True" and False" string for bool.ToString()

How to chage "True" and False" string for bool.ToString()

Scheduled Pinned Locked Moved C#
tutorial
5 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    machocr
    wrote on last edited by
    #1

    Hi is possible to chage ToString result for bool type to any languange or text example Si/No} :confused: La realidad no es más que impulsos eléctricos del cerebro - Morpheus

    W T J 3 Replies Last reply
    0
    • M machocr

      Hi is possible to chage ToString result for bool type to any languange or text example Si/No} :confused: La realidad no es más que impulsos eléctricos del cerebro - Morpheus

      W Offline
      W Offline
      WetRivrRat
      wrote on last edited by
      #2

      you could try to overload it....never tried it, but maybe worth a shot... or you could just build a method that verifies the si--yes, no--no, etc... 'course you could do some work with Localization, that would achieve the same/similar results depending on how/where its used. string Beautiful; Beautiful = "ignorant"; label1.Text = "The world is full of " + Beautiful +" people."; Why is common sense such an un-common comodity?

      1 Reply Last reply
      0
      • M machocr

        Hi is possible to chage ToString result for bool type to any languange or text example Si/No} :confused: La realidad no es más que impulsos eléctricos del cerebro - Morpheus

        T Offline
        T Offline
        TheGreatAndPowerfulOz
        wrote on last edited by
        #3

        write your own function that converts a bool to Si/No

        L 1 Reply Last reply
        0
        • T TheGreatAndPowerfulOz

          write your own function that converts a bool to Si/No

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          string fromBool(bool value) { return value ? "Si" : "No"; }

          1 Reply Last reply
          0
          • M machocr

            Hi is possible to chage ToString result for bool type to any languange or text example Si/No} :confused: La realidad no es más que impulsos eléctricos del cerebro - Morpheus

            J Offline
            J Offline
            Jared Parsons
            wrote on last edited by
            #5

            You could try passing in the appropriate CultureInfo into the ToString() method. I don't do much globalization in my code but I think that will work. Jared Parsons jaredp@beanseed.org http://spaces.msn.com/members/jaredp/

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups