Cannot convert type 'int' to 'bool'



The following code:

int test = 1;
bool isTrue = (bool)test;

results in a compiler error:

Cannot convert type 'int' to 'bool'

wtf, any ideas on how to work around this?
.



Relevant Pages

  • Re: Cannot convert type int to bool
    ... results in a compiler error: ... wtf, any ideas on how to work around this? ... bool isTrue = Convert.ToBoolean; ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Cannot convert type int to bool
    ... results in a compiler error: ... Cannot convert type 'int' to 'bool' ... wtf, any ideas on how to work around this? ...
    (microsoft.public.dotnet.languages.csharp)