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
  1. Home
  2. The Lounge
  3. Mrrm, gotta love .NET

Mrrm, gotta love .NET

Scheduled Pinned Locked Moved The Lounge
csharpcomxmlquestionlearning
23 Posts 18 Posters 2 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.
  • E Ennis Ray Lynch Jr

    This isn't a new annoyance. Just every time I have to deal with it I get all riled up. In the C# language

    true
    false

    but

    true.ToString() == "True"
    false.ToString() == "False"

    Of course xml is "true" and "false" http://www.w3.org/TR/xmlschema-2/#boolean[^] Whomever At Microsoft Decided That Everything No Matter What Should Start With A Capital Letter Should Be Dragged Outside And Shot.

    Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
    If you don't ask questions the answers won't stand in your way.
    Most of this sig is for Google, not ego.

    S Offline
    S Offline
    Schmuli
    wrote on last edited by
    #21

    I would have to say, having read most of the previous replies, that this is one of those cases where there is more than one way to perform one operation. In this case, converting a non-string into a string value. Saying that the returned value from Boolean.ToString() should be lower-case just because XML defines the string definition of a Boolean as such, means that at some point, when you expect upper-case, the framework is again unreliable. As pointed out, and the XML classes in .NET, such as XmlWriter, already do, you can use the XmlConvert class to get a XML representation. For example, when using an XmlWriter, there is a WriteValue(bool value) method, which will handle the conversion in a similar manner.

    1 Reply Last reply
    0
    • R Rama Krishna Vavilala

      The real problem is not that ToString returns "True" and "False". Rather I think the real issue us that there is no way to get a culture specific string from a Boolean. even ToString(IFormatProvider ) ignores culture.

      S Offline
      S Offline
      Schmuli
      wrote on last edited by
      #22

      Could I suggest you look at CultureInfo Class[^] for more details on culture specific formatting. Specifically, look at the TextInfo property and what it represents. You should then understand why your statement is incorrect in this circumstance.

      1 Reply Last reply
      0
      • E Ennis Ray Lynch Jr

        This isn't a new annoyance. Just every time I have to deal with it I get all riled up. In the C# language

        true
        false

        but

        true.ToString() == "True"
        false.ToString() == "False"

        Of course xml is "true" and "false" http://www.w3.org/TR/xmlschema-2/#boolean[^] Whomever At Microsoft Decided That Everything No Matter What Should Start With A Capital Letter Should Be Dragged Outside And Shot.

        Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
        If you don't ask questions the answers won't stand in your way.
        Most of this sig is for Google, not ego.

        D Offline
        D Offline
        DaveyM69
        wrote on last edited by
        #23

        Gotta say, every time I try and do anything to 'connect' to other (normally non MS) technologies in .NET I end up creating simple wrappers around alot of the types. This would be another potential case - just to override the default ToString implemtation.

        Dave
        BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
        Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)

        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