How do I assing opposit of boolean? 
Author Message
 How do I assing opposit of boolean?

I am trying to do the following in C#

Sample VB code

dim blnTemp as boolean
dim blnOther as boolean

blnOther = false
blnTemp = not blnOther

blnTemp = True?



Mon, 23 May 2005 01:30:15 GMT  
 How do I assing opposit of boolean?
To flip a bool in C#, just:

bool isHappy = false;

isHappy = ! isHappy; // now true

isHappy = ! isHappy; // now false

-c


Quote:
> I am trying to do the following in C#

> Sample VB code

> dim blnTemp as boolean
> dim blnOther as boolean

> blnOther = false
> blnTemp = not blnOther

> blnTemp = True?



Mon, 23 May 2005 01:32:46 GMT  
 How do I assing opposit of boolean?
bool blnTemp = false;
bool blnOther = !blnTemp;

Have a look at:
http://msdn.microsoft.com/library/en-us/csref/html/vclrfcsharpoperato...
(the link may wrap)

Greetings
Marty

Quote:
> I am trying to do the following in C#

> Sample VB code

> dim blnTemp as boolean
> dim blnOther as boolean

> blnOther = false
> blnTemp = not blnOther

> blnTemp = True?



Mon, 23 May 2005 01:37:28 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Is there an itoa() function (opposit of atoi())????

2. VARIANT, VARIANT_BOOL, and VB Boolean - how is this done?

3. Marshalling System.Boolean datatype.

4. System.Boolean Interoperability with COM

5. Program to Evaluate Boolean Expressions

6. question about Boolean statements in c

7. boolean data type in C

8. type of boolean in c?

9. Does sizeof(CORBA::Boolean) have to be 1

10. I need a function like boolean isopen( FILE *stream)

11. Help - Declaring a Boolean

12. Floats as boolean values; generic function pointers

 

 
Powered by phpBB® Forum Software