Re: Cannot convert type 'int' to 'bool'
- From: Registered User <n4jvp@xxxxxxxxxxxxx>
- Date: Sat, 22 Sep 2007 02:25:39 -0400
On Fri, 21 Sep 2007 21:39:26 -0700, John <no@xxxxxxxx> wrote:
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?
bool isTrue = Convert.ToBoolean(test);
You will find that non-zero integer arguments to Convert.ToBoolean all
return true.
regards
A.G.
.
- Follow-Ups:
- Re: Cannot convert type 'int' to 'bool'
- From: Göran Andersson
- Re: Cannot convert type 'int' to 'bool'
- References:
- Cannot convert type 'int' to 'bool'
- From: John
- Cannot convert type 'int' to 'bool'
- Prev by Date: Re: Timer Help Needed Win{C#]
- Next by Date: Re: Cannot convert type 'int' to 'bool'
- Previous by thread: Re: Cannot convert type 'int' to 'bool'
- Next by thread: Re: Cannot convert type 'int' to 'bool'
- Index(es):
Relevant Pages
|