Re: [ADVANCED-DOTNET] Gripe out the C# compiler...

2006-08-04 Thread Mike Andrews
; > Thanks, > Mike > > > On 8/3/06, Chris Anderson <[EMAIL PROTECTED]> wrote: > > > > bool x = (value != 0); > > > > > > > -Original Message- > > > From: Discussion of advanced .NET topics. > > > [mailt

Re: [ADVANCED-DOTNET] Gripe out the C# compiler...

2006-08-03 Thread Sébastien Lorion
ggestions how I can revise my code to allow for nullable types, I'd like to see it. Thanks, Mike On 8/3/06, Chris Anderson <[EMAIL PROTECTED]> wrote: > > bool x = (value != 0); > > > > -Original Message- > > From: Discussion of advanced .NET topics. &

Re: [ADVANCED-DOTNET] Gripe out the C# compiler...

2006-08-03 Thread Mike Andrews
ke to see it. Thanks, Mike On 8/3/06, Chris Anderson <[EMAIL PROTECTED]> wrote: bool x = (value != 0); > -Original Message- > From: Discussion of advanced .NET topics. > [mailto:[EMAIL PROTECTED] On Behalf Of Mike Andrews > Sent: 03 August 2006 14:16 > To: ADVANCED-

Re: [ADVANCED-DOTNET] Gripe out the C# compiler...

2006-08-03 Thread Marc Brooks
Can anyone tell me any good reason why the C# compiler will not allow casting an int to a bool? 0) Because a bool is not an int (and a System.Boolean is not a System.Int32 etc...) 1) To resolve the ambiguity about what value true is (e.g. -1, non-zero, whatever). 2) To prevent stupidity like the

Re: [ADVANCED-DOTNET] Gripe out the C# compiler...

2006-08-03 Thread John Brett
Can anyone tell me any good reason why the C# compiler will not allow casting an int to a bool? What's the mapping of integers to boolean values? If you're a C (C++) programmer, you'll say 0 -> false !0 -> true and consider the answer blindingly obvious. The question would be less obvious to a

Re: [ADVANCED-DOTNET] Gripe out the C# compiler...

2006-08-03 Thread Frans Bouma
> Can anyone tell me any good reason why the C# compiler will > not allow casting an int to a bool? because a bool isn't an int? :) It's not C++ ;) FB > > example: > > bool x = (bool)1; > > > instead of doing something like this: > bool x = Convert.ToBoolean(1); > or > bo

Re: [ADVANCED-DOTNET] Gripe out the C# compiler...

2006-08-03 Thread Chris Anderson
bool x = (value != 0); > -Original Message- > From: Discussion of advanced .NET topics. > [mailto:[EMAIL PROTECTED] On Behalf Of Mike Andrews > Sent: 03 August 2006 14:16 > To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM > Subject: [ADVANCED-DOTNET] Gripe out the C# com

Re: [ADVANCED-DOTNET] Gripe out the C# compiler...

2006-08-03 Thread Bob Provencher
-DOTNET] Gripe out the C# compiler... Guys, Can anyone tell me any good reason why the C# compiler will not allow casting an int to a bool? example: bool x = (bool)1; instead of doing something like this: bool x = Convert.ToBoolean(1); or bool x = bool.Parse(1); Makes it very difficult to write

[ADVANCED-DOTNET] Gripe out the C# compiler...

2006-08-03 Thread Mike Andrews
Guys, Can anyone tell me any good reason why the C# compiler will not allow casting an int to a bool? example: bool x = (bool)1; instead of doing something like this: bool x = Convert.ToBoolean(1); or bool x = bool.Parse(1); Makes it very difficult to write generic methods where I need to ca