Click or drag to resize
ConvertToByte Method (Object)
Converts the value of the specified object to an 8-bit unsigned integer.

Namespace: System
Assembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax
C#
public static byte ToByte(
	Object value
)

Parameters

value
Type: SystemObject
An object that implements the IConvertible interface, or null.

Return Value

Type: Byte
An 8-bit unsigned integer that is equivalent to value, or zero if value is null.
Exceptions
ExceptionCondition
FormatExceptionvalue is not in the property format for a Byte value.
InvalidCastExceptionvalue does not implement IConvertible. -or-Conversion from value to the Byte type is not supported.
OverflowExceptionvalue represents a number that is less than MinValue or greater than MaxValue.
See Also