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

Reply via email to