Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

c# int to bool

// Simple way, may crash if intValue > 1
int intValue = 1;
bool boolValue = intValue != 0;
// value of boolValue: true

// Better way
int intValue = 1;
bool boolValue = System.Convert.ToBoolean(intValue);
// value of boolValue: true
 
PREVIOUS NEXT
Tagged: #int #bool
ADD COMMENT
Topic
Name
5+2 =