BitConverter.ToBoolean Method (Byte[], Int32)


Returns a Boolean value converted from the byte at a specified position in a byte array.

Namespace:   System
Assembly:  mscorlib (in mscorlib.dll)

static member ToBoolean : 
        value:byte[] *
        startIndex:int -> bool


Type: System.Byte[]

A byte array.

Type: System.Int32

The index of the byte within value.

Return Value

Type: System.Boolean

true if the byte at startIndex in value is nonzero; otherwise, false.

Exception Condition

value is null.


startIndex is less than zero or greater than the length of value minus 1.

To convert a Boolean value to its byte representation, call the ToBoolean method.

The following code example converts elements of Byte arrays to Boolean values with the ToBoolean method.

No code example is currently available or this language may not be supported.

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top