Hi, I am rewriting my cpp app to c# and I am unable to convert this part:
int flags = object.Flags;
if (flags & 1)
{
...
}
if (flags & 2)
{
...
}
I am getting this error: 'Cannot implicitly convert type 'int' to 'bool''
Thx for help.
Hi, I am rewriting my cpp app to c# and I am unable to convert this part:
int flags = object.Flags;
if (flags & 1)
{
...
}
if (flags & 2)
{
...
}
I am getting this error: 'Cannot implicitly convert type 'int' to 'bool''
Thx for help.
cpp to c# - & operator
Vampire7639
Osiris43
franziss
You are performing Bitwise & on 2 integer numbers which will result in another interger while If(....) statement excepts a bool value instead so you ar getting this error. Can you post that portion of C++ code may be you are doing some mistake in conversion so we can think and solve it.
Best Regards,
Rizwan aka RizwanSharp
Francesco De Vittori
Dreedle
Hi,
i had the same problem, while i am migrate from c/c++ to c# for a long time... The problem is that in c# the if-"Courier New, Courier, Monospace" color=#0000ff>int flags = object.Flags;
if ( (flags & 1) != 0)
{
...
}
if ( (flags & 2) != 0)
{
...
}