In cases like that I usually do something like bool x = ( value != 0 );
-----Original Message----- From: Discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] On Behalf Of Mike Andrews Sent: Thursday, August 03, 2006 9:15 AM To: [email protected] Subject: [ADVANCED-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 generic methods where I need to cast a value to a bool. Thanks, Mike =================================== This list is hosted by DevelopMentor® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentor® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com
