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 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.
  • R Rama Krishna Vavilala

    :confused: What has web development to do with Boolean string representation (and howis it not significant in windows forms development)?

    E Offline
    E Offline
    Ennis Ray Lynch Jr
    wrote on last edited by
    #7

    In windows development you can and should always use the Boolean object. In web development you must constantly switch between object and string representation. I have a lot of casing rants with respect to ASP.NET however.

    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.

    M 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
      Daniel Grunwald
      wrote on last edited by
      #8

      If you're using XML, use System.Xml.XmlConvert[^] instead of the normal conversions.

      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.

        C Offline
        C Offline
        Colin Angus Mackay
        wrote on last edited by
        #9

        Ennis Ray Lynch, Jr. wrote:

        gotta love .NET

        You don't HAVE to love .NET... But I do. It is warm and fuzzy :-D

        * Developer Day Scotland 2 - Free community conference * The Blog of Colin Angus Mackay


        Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.

        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.

          E Offline
          E Offline
          emiaj
          wrote on last edited by
          #10

          While MS keep pushing us with new stuffs, the old bugs never get fixed.

          Jaime Febres The worst blog in the world

          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.

            L Offline
            L Offline
            leppie
            wrote on last edited by
            #11

            TypeConverter is your friend :)

            xacc.ide - now with TabsToSpaces support
            IronScheme - 1.0 beta 1 - out now!
            ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))

            P 1 Reply Last reply
            0
            • L leppie

              TypeConverter is your friend :)

              xacc.ide - now with TabsToSpaces support
              IronScheme - 1.0 beta 1 - out now!
              ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))

              P Offline
              P Offline
              Pete OHanlon
              wrote on last edited by
              #12

              leppie wrote:

              TypeConverter is your friend

              He's not mine - I beat the crap out of him when he refused to stand his round. Cheap b4st4rd.

              "WPF has many lovers. It's a veritable porn star!" - Josh Smith

              My blog | My articles | MoXAML PowerToys

              N 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.

                B Offline
                B Offline
                Brady Kelly
                wrote on last edited by
                #13

                I am sooo with you on that. :mad:

                All Sorted

                1 Reply Last reply
                0
                • E Ennis Ray Lynch Jr

                  In windows development you can and should always use the Boolean object. In web development you must constantly switch between object and string representation. I have a lot of casing rants with respect to ASP.NET however.

                  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.

                  M Offline
                  M Offline
                  Member 96
                  wrote on last edited by
                  #14

                  Yeah I hear you, I have a lot of code in my asp.net interfaces for doing string conversions.


                  "It's so simple to be wise. Just think of something stupid to say and then don't say it." -Sam Levenson

                  1 Reply Last reply
                  0
                  • P Pete OHanlon

                    leppie wrote:

                    TypeConverter is your friend

                    He's not mine - I beat the crap out of him when he refused to stand his round. Cheap b4st4rd.

                    "WPF has many lovers. It's a veritable porn star!" - Josh Smith

                    My blog | My articles | MoXAML PowerToys

                    N Offline
                    N Offline
                    Nish Nishant
                    wrote on last edited by
                    #15

                    Pete O'Hanlon wrote:

                    He's not mine

                    "He"? I thought we all agreed that all BCL converter classes are female, Pete? And then you go ahead and disregard that! :|

                    Regards, Nish


                    Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
                    My latest book : C++/CLI in Action / Amazon.com link

                    P 1 Reply Last reply
                    0
                    • N Nish Nishant

                      Pete O'Hanlon wrote:

                      He's not mine

                      "He"? I thought we all agreed that all BCL converter classes are female, Pete? And then you go ahead and disregard that! :|

                      Regards, Nish


                      Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
                      My latest book : C++/CLI in Action / Amazon.com link

                      P Offline
                      P Offline
                      Pete OHanlon
                      wrote on last edited by
                      #16

                      Nishant Sivakumar wrote:

                      I thought we all agreed that all BCL converter classes are female, Pete? And then you go ahead and disregard that!

                      No female would be so stupid as to get between me and my drink. Period. Add your own punchlines.

                      "WPF has many lovers. It's a veritable porn star!" - Josh Smith

                      My blog | My articles | MoXAML PowerToys

                      1 Reply Last reply
                      0
                      • C Christian Graus

                        I would never do a string comparison that did not ignore case.

                        Christian Graus Driven to the arms of OSX by Vista.

                        C Offline
                        C Offline
                        CPallini
                        wrote on last edited by
                        #17

                        I would never do the opposite. :)

                        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                        [My articles]

                        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.

                          P Offline
                          P Offline
                          PIEBALDconsult
                          wrote on last edited by
                          #18

                          Ah, so you want the ability to have: true == ":thumbsup:" and false == ":thumbsdown:"

                          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.

                            K Offline
                            K Offline
                            Kastellanos Nikos
                            wrote on last edited by
                            #19

                            Which reminds me that C had it right from the begining.

                            #define FALSE 0
                            #define TRUE !FALSE

                            I believe we can all agree to that and let our cultural differences aside.. :)

                            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.

                              P Offline
                              P Offline
                              Peter Kibble
                              wrote on last edited by
                              #20

                              Just go with the flow, accept most human endevours are flawed and avoid fundementalism.

                              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.

                                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