It seems like it would make sense to have them both the same.
Metro T. Sauper, Jr.
President
Sauper Associates, Inc.
What are you doing that brought this up?
--
Greg Ewing [MVP]
http://www.citidc.com/
"Metro Sauper" <msa...@sauper.com> wrote in message
news:O2npemkm...@TK2MSFTNGP09.phx.gbl...
Try this:
using System;
public class Test
{
static void Main()
{
Console.WriteLine (true.ToString());
Console.WriteLine (false.ToString());
}
}
That prints:
True
False
I'm pretty sure that's what the OP was talking about.
It's not C# that does this, of course, but .NET itself.
--
Jon Skeet - <sk...@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
--
Greg Ewing [MVP]
http://www.citidc.com/
"Jon Skeet [C# MVP]" <sk...@pobox.com> wrote in message
news:MPG.1a0377eed...@msnews.microsoft.com...
I think the true, false in C# are the type value of C#, and it is the
mapping of .Net Framework type value. While in .Net, this type value is
True and False.
This is similiar as the int vs Int32, string vs String type mapping
relationship.
Hope this help,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
--------------------
| From: Jon Skeet [C# MVP] <sk...@pobox.com>
| Subject: Re: Ask a Language Designer: boolean: C# vs. Xml
| Date: Fri, 24 Oct 2003 18:55:27 +0100
| Message-ID: <MPG.1a0377eed...@msnews.microsoft.com>
| References: <O2npemkm...@TK2MSFTNGP09.phx.gbl>
<uL0Fb7km...@TK2MSFTNGP12.phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain; charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: MicroPlanet Gravity v2.60
| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: cpc3-rdng5-6-0-cust143.winn.cable.ntl.com
81.103.154.143
| Lines: 1
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:193868
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
We are using xml to store some default configuration for reports. An xml
entry might appear as follows:
<Parameter Name="ShowDetail" Type="System.Boolean" Value="true" />
Now normally with xml, we use "XmlConvert.ToBoolean(string)" to convert
values from xml to the specific datatype, in this case boolean.
However, because the datatype is defined in the entry and not predefined, I
wanted to use the Convert.ChangeType() method to evaluate the entry.
Somthing like:
object parameterValue = Convert.ChanageType(node.Attributes["Value"].Value,
System.GetType(node.Attributes[Type].Value));
However, this did not work because we configured the value as "true" rather
than "True". So now our configuration xml has "true/false" everywhere there
are boolean values EXCEPT for the parameter values where the value is
"True/False" since we use the XmlConvert for all values other than the ones
where we would like to use Convert.ChangeType().
Now, I know how to solve the problem. There are lots of ways to solve it.
That is not the question. I posed the question after reading the other "Ask
a Language Designer" questions and responded to the offer to post a question
here.
The question is "Why are the default text representations for boolean
different in .Net and XML?"
Thank you for you consideration of this question.
Metro T. Sauper, Jr.
President
Sauper Associates, Inc.
""Jeffrey Tan[MSFT]"" <v-j...@online.microsoft.com> wrote in message
news:NFHhPArm...@cpmsftngxa06.phx.gbl...
Thanks for your feedback.
I think our discussion already shows that in C# the bool type's value are
true and false, while the bool type is mapping to the .Net Framework
Boolean type and its value are True and False.
Does this answer your question?
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
--------------------
| From: "Metro Sauper" <msa...@sauper.com>
| References: <O2npemkm...@TK2MSFTNGP09.phx.gbl>
<uL0Fb7km...@TK2MSFTNGP12.phx.gbl>
<MPG.1a0377eed...@msnews.microsoft.com>
<NFHhPArm...@cpmsftngxa06.phx.gbl>
| Subject: Re: Ask a Language Designer: boolean: C# vs. Xml
| Date: Sat, 25 Oct 2003 01:19:47 -0400
| Lines: 111
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <#CXWDfrm...@TK2MSFTNGP10.phx.gbl>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: pcp047007pcs.trnrsv01.nj.comcast.net 68.46.19.104
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:193972
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
Well actually no. It doesn't answer my question.
I do understand what you are saying. We realized this the moment we
encountered the problem and changed our program accordingly.
Perhaps I expected too much when posting my original question. I was
looking for someone "in the know" to explain to me why the values were
different in the first place. What the "aha!" answer was that would make me
understand why the values need to be different in the first place -- that
there was more reason than the .Net implementors flipped a coin and
"capital" 'F' and 'T' won.
There is really no reason to continue this thread. I understand the
technical aspects of the issue.
Best regards,
Metro.
--------------------------------
Metro T. Sauper, Jr.
President
Sauper Associates, Inc.
""Jeffrey Tan[MSFT]"" <v-j...@online.microsoft.com> wrote in message
news:y2UCMKt...@cpmsftngxa06.phx.gbl...