Mono Class Library: System.Convert Overview | Members

System.Convert.ToBoolean Method

Converts a short to a bool . [Edit]

public static bool ToBoolean (short value)

Parameters

value
The 16-bit signed integer value to be converted. [Edit]

Returns

true if value is non-zero; false if value is zero. [Edit]

Remarks

Documentation for this section has not yet been entered. [Edit]

Example

The following example demonstrates converting byte values to bool values.

C# Example
using System;
class ConvertBoolTest {
    static public void Main() {
        short short0 = 0;
        short short1 = 1; 
        short short2 = -2;
        bool bool0 = Convert.ToBoolean(short0);
        bool bool1 = Convert.ToBoolean(short1);
        bool bool2 = Convert.ToBoolean(short2);
        Console.WriteLine("(short) {0} as bool = {1}",short0,bool0);
        Console.WriteLine("(short) {0} as bool = {1}",short1,bool1);
        Console.WriteLine("(short) {0} as bool = {1}",short2,bool2);
    }
}

The output is

(short) 0 as bool = False
(short) 1 as bool = True
(short) -2 as bool = True

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0