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 VB programmer. To a COM programmer, then the mapping is -1 -> true NOT(-1) -> false which is a completely different and partially incompatible mapping.
Makes it very difficult to write generic methods where I need to cast a value to a bool.
I'm sorry but this I don't get. Surely the point of generics is to make your code type safe, so that you don't have to perform this kind of type coercion? John =================================== This list is hosted by DevelopMentor® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com
