Mrrm, gotta love .NET
-
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
falsebut
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. -
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))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
-
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
falsebut
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.I am sooo with you on that. :mad:
-
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. -
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
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 -
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 linkNishant 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
-
I would never do a string comparison that did not ignore case.
Christian Graus Driven to the arms of OSX by Vista.
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] -
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.Ah, so you want the ability to have: true == ":thumbsup:" and false == ":thumbsdown:"
-
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.Which reminds me that C had it right from the begining.
#define FALSE 0
#define TRUE !FALSEI believe we can all agree to that and let our cultural differences aside.. :)
-
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
falsebut
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.Just go with the flow, accept most human endevours are flawed and avoid fundementalism.
-
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
falsebut
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.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 asXmlWriter
, already do, you can use theXmlConvert
class to get a XML representation. For example, when using anXmlWriter
, there is aWriteValue(bool value)
method, which will handle the conversion in a similar manner. -
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.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.
-
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
falsebut
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.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)