Converts a ushort to a bool .
[Edit]
[System.CLSCompliant(false)] public static bool ToBoolean (ushort value) |
|
Parameters
- value
- The 16-bit unsigned integer 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 short values
to bool values.
C# Example |
using System;
class ConvertBoolTest {
static public void Main() {
ushort ushort0 = 0;
ushort ushort1 = 1;
bool bool0 = Convert.ToBoolean(ushort0);
bool bool1 = Convert.ToBoolean(ushort1);
Console.WriteLine("(ushort) {0} as bool = {1}",ushort0,bool0);
Console.WriteLine("(ushort) {0} as bool = {1}",ushort1,bool1);
}
}
|
The output is
(ushort) 0 as bool = False
(ushort) 1 as bool = True
Requirements
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0