Converts a byte to a bool
.
[Edit]
public static bool ToBoolean (byte value) |
|
Parameters
- value
- The byte value to be converted.
[Edit]
Returns
true if value is non-zero;
false if value is zero.
[Edit]
Remarks
Example
The following example demonstrates converting byte values to bool values.
C# Example |
using System;
class ConvertBoolTest {
static public void Main() {
byte byte0 = (byte) 0;
byte byte1 = (Byte) 1;
bool bool0 = Convert.ToBoolean(byte0);
bool bool1 = Convert.ToBoolean(byte1);
Console.WriteLine("(byte) {0} as bool = {1}",byte0,bool0);
Console.WriteLine("(byte) {0} as bool = {1}",byte1,bool1);
}
}
|
The output is
(byte) 0 as bool = False
(byte) 1 as bool = True
Requirements
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0