Class BitConverterEx
An endian-aware converter for converting between base data types
and an array of bytes.
Inheritance
System.Object
BitConverterEx
Assembly: ExifLibrary.dll
Syntax
public class BitConverterEx
Constructors
|
Improve this Doc
View Source
BitConverterEx(BitConverterEx.ByteOrder, BitConverterEx.ByteOrder)
Declaration
public BitConverterEx(BitConverterEx.ByteOrder from, BitConverterEx.ByteOrder to)
Parameters
Properties
|
Improve this Doc
View Source
BigEndian
Returns a bit converter that converts between big-endian and system byte-order.
Declaration
public static BitConverterEx BigEndian { get; }
Property Value
|
Improve this Doc
View Source
LittleEndian
Returns a bit converter that converts between little-endian and system byte-order.
Declaration
public static BitConverterEx LittleEndian { get; }
Property Value
|
Improve this Doc
View Source
SystemByteOrder
Indicates the byte order in which data is stored in this platform.
Declaration
public static BitConverterEx.ByteOrder SystemByteOrder { get; }
Property Value
|
Improve this Doc
View Source
SystemEndian
Returns a bit converter that does not do any byte-order conversion.
Declaration
public static BitConverterEx SystemEndian { get; }
Property Value
Methods
|
Improve this Doc
View Source
GetBytes(Double)
Converts the given double precision floating-point number to an array of bytes.
Declaration
public byte[] GetBytes(double value)
Parameters
Type |
Name |
Description |
System.Double |
value |
|
Returns
Type |
Description |
System.Byte[] |
|
|
Improve this Doc
View Source
GetBytes(Double, BitConverterEx.ByteOrder, BitConverterEx.ByteOrder)
Converts the given double precision floating-point number to an array of bytes.
Declaration
public static byte[] GetBytes(double value, BitConverterEx.ByteOrder from, BitConverterEx.ByteOrder to)
Parameters
Returns
Type |
Description |
System.Byte[] |
|
|
Improve this Doc
View Source
GetBytes(Int16)
Converts the given 16-bit signed integer to an array of bytes.
Declaration
public byte[] GetBytes(short value)
Parameters
Type |
Name |
Description |
System.Int16 |
value |
|
Returns
Type |
Description |
System.Byte[] |
|
|
Improve this Doc
View Source
GetBytes(Int16, BitConverterEx.ByteOrder, BitConverterEx.ByteOrder)
Converts the given 16-bit signed integer to an array of bytes.
Declaration
public static byte[] GetBytes(short value, BitConverterEx.ByteOrder from, BitConverterEx.ByteOrder to)
Parameters
Returns
Type |
Description |
System.Byte[] |
|
|
Improve this Doc
View Source
GetBytes(Int32)
Converts the given 32-bit signed integer to an array of bytes.
Declaration
public byte[] GetBytes(int value)
Parameters
Type |
Name |
Description |
System.Int32 |
value |
|
Returns
Type |
Description |
System.Byte[] |
|
|
Improve this Doc
View Source
GetBytes(Int32, BitConverterEx.ByteOrder, BitConverterEx.ByteOrder)
Converts the given 32-bit signed integer to an array of bytes.
Declaration
public static byte[] GetBytes(int value, BitConverterEx.ByteOrder from, BitConverterEx.ByteOrder to)
Parameters
Returns
Type |
Description |
System.Byte[] |
|
|
Improve this Doc
View Source
GetBytes(Int64)
Converts the given 64-bit signed integer to an array of bytes.
Declaration
public byte[] GetBytes(long value)
Parameters
Type |
Name |
Description |
System.Int64 |
value |
|
Returns
Type |
Description |
System.Byte[] |
|
|
Improve this Doc
View Source
GetBytes(Int64, BitConverterEx.ByteOrder, BitConverterEx.ByteOrder)
Converts the given 64-bit signed integer to an array of bytes.
Declaration
public static byte[] GetBytes(long value, BitConverterEx.ByteOrder from, BitConverterEx.ByteOrder to)
Parameters
Returns
Type |
Description |
System.Byte[] |
|
|
Improve this Doc
View Source
GetBytes(Single)
Converts the given single precision floating-point number to an array of bytes.
Declaration
public byte[] GetBytes(float value)
Parameters
Type |
Name |
Description |
System.Single |
value |
|
Returns
Type |
Description |
System.Byte[] |
|
|
Improve this Doc
View Source
GetBytes(Single, BitConverterEx.ByteOrder, BitConverterEx.ByteOrder)
Converts the given single precision floating-point number to an array of bytes.
Declaration
public static byte[] GetBytes(float value, BitConverterEx.ByteOrder from, BitConverterEx.ByteOrder to)
Parameters
Returns
Type |
Description |
System.Byte[] |
|
|
Improve this Doc
View Source
GetBytes(UInt16)
Converts the given 16-bit unsigned integer to an array of bytes.
Declaration
public byte[] GetBytes(ushort value)
Parameters
Type |
Name |
Description |
System.UInt16 |
value |
|
Returns
Type |
Description |
System.Byte[] |
|
|
Improve this Doc
View Source
GetBytes(UInt16, BitConverterEx.ByteOrder, BitConverterEx.ByteOrder)
Converts the given 16-bit unsigned integer to an array of bytes.
Declaration
public static byte[] GetBytes(ushort value, BitConverterEx.ByteOrder from, BitConverterEx.ByteOrder to)
Parameters
Returns
Type |
Description |
System.Byte[] |
|
|
Improve this Doc
View Source
GetBytes(UInt32)
Converts the given 32-bit unsigned integer to an array of bytes.
Declaration
public byte[] GetBytes(uint value)
Parameters
Type |
Name |
Description |
System.UInt32 |
value |
|
Returns
Type |
Description |
System.Byte[] |
|
|
Improve this Doc
View Source
GetBytes(UInt32, BitConverterEx.ByteOrder, BitConverterEx.ByteOrder)
Converts the given 32-bit unsigned integer to an array of bytes.
Declaration
public static byte[] GetBytes(uint value, BitConverterEx.ByteOrder from, BitConverterEx.ByteOrder to)
Parameters
Returns
Type |
Description |
System.Byte[] |
|
|
Improve this Doc
View Source
GetBytes(UInt64)
Converts the given 64-bit unsigned integer to an array of bytes.
Declaration
public byte[] GetBytes(ulong value)
Parameters
Type |
Name |
Description |
System.UInt64 |
value |
|
Returns
Type |
Description |
System.Byte[] |
|
|
Improve this Doc
View Source
GetBytes(UInt64, BitConverterEx.ByteOrder, BitConverterEx.ByteOrder)
Converts the given 64-bit unsigned integer to an array of bytes.
Declaration
public static byte[] GetBytes(ulong value, BitConverterEx.ByteOrder from, BitConverterEx.ByteOrder to)
Parameters
Returns
Type |
Description |
System.Byte[] |
|
|
Improve this Doc
View Source
ToChar(Byte[], Int64)
Converts the given array of bytes to a 16-bit unsigned integer.
Declaration
public char ToChar(byte[] value, long startIndex)
Parameters
Type |
Name |
Description |
System.Byte[] |
value |
|
System.Int64 |
startIndex |
|
Returns
Type |
Description |
System.Char |
|
|
Improve this Doc
View Source
ToChar(Byte[], Int64, BitConverterEx.ByteOrder, BitConverterEx.ByteOrder)
Converts the given array of bytes to a Unicode character.
Declaration
public static char ToChar(byte[] value, long startIndex, BitConverterEx.ByteOrder from, BitConverterEx.ByteOrder to)
Parameters
Returns
Type |
Description |
System.Char |
|
|
Improve this Doc
View Source
ToDouble(Byte[], Int64)
Converts the given array of bytes to a double precision floating number.
Declaration
public double ToDouble(byte[] value, long startIndex)
Parameters
Type |
Name |
Description |
System.Byte[] |
value |
|
System.Int64 |
startIndex |
|
Returns
Type |
Description |
System.Double |
|
|
Improve this Doc
View Source
ToDouble(Byte[], Int64, BitConverterEx.ByteOrder, BitConverterEx.ByteOrder)
Converts the given array of bytes to a double precision floating number.
Declaration
public static double ToDouble(byte[] value, long startIndex, BitConverterEx.ByteOrder from, BitConverterEx.ByteOrder to)
Parameters
Returns
Type |
Description |
System.Double |
|
|
Improve this Doc
View Source
ToInt16(Byte[], Int64)
Converts the given array of bytes to a 16-bit signed integer.
Declaration
public short ToInt16(byte[] value, long startIndex)
Parameters
Type |
Name |
Description |
System.Byte[] |
value |
|
System.Int64 |
startIndex |
|
Returns
Type |
Description |
System.Int16 |
|
|
Improve this Doc
View Source
ToInt16(Byte[], Int64, BitConverterEx.ByteOrder, BitConverterEx.ByteOrder)
Converts the given array of bytes to a 16-bit signed integer.
Declaration
public static short ToInt16(byte[] value, long startIndex, BitConverterEx.ByteOrder from, BitConverterEx.ByteOrder to)
Parameters
Returns
Type |
Description |
System.Int16 |
|
|
Improve this Doc
View Source
ToInt32(Byte[], Int64)
Converts the given array of bytes to a 32-bit signed integer.
Declaration
public int ToInt32(byte[] value, long startIndex)
Parameters
Type |
Name |
Description |
System.Byte[] |
value |
|
System.Int64 |
startIndex |
|
Returns
Type |
Description |
System.Int32 |
|
|
Improve this Doc
View Source
ToInt32(Byte[], Int64, BitConverterEx.ByteOrder, BitConverterEx.ByteOrder)
Converts the given array of bytes to a 32-bit signed integer.
Declaration
public static int ToInt32(byte[] value, long startIndex, BitConverterEx.ByteOrder from, BitConverterEx.ByteOrder to)
Parameters
Returns
Type |
Description |
System.Int32 |
|
|
Improve this Doc
View Source
ToInt64(Byte[], Int64)
Converts the given array of bytes to a 64-bit signed integer.
Declaration
public long ToInt64(byte[] value, long startIndex)
Parameters
Type |
Name |
Description |
System.Byte[] |
value |
|
System.Int64 |
startIndex |
|
Returns
Type |
Description |
System.Int64 |
|
|
Improve this Doc
View Source
ToInt64(Byte[], Int64, BitConverterEx.ByteOrder, BitConverterEx.ByteOrder)
Converts the given array of bytes to a 64-bit signed integer.
Declaration
public static long ToInt64(byte[] value, long startIndex, BitConverterEx.ByteOrder from, BitConverterEx.ByteOrder to)
Parameters
Returns
Type |
Description |
System.Int64 |
|
|
Improve this Doc
View Source
ToSingle(Byte[], Int64)
Converts the given array of bytes to a single precision floating number.
Declaration
public float ToSingle(byte[] value, long startIndex)
Parameters
Type |
Name |
Description |
System.Byte[] |
value |
|
System.Int64 |
startIndex |
|
Returns
Type |
Description |
System.Single |
|
|
Improve this Doc
View Source
ToSingle(Byte[], Int64, BitConverterEx.ByteOrder, BitConverterEx.ByteOrder)
Converts the given array of bytes to a single precision floating number.
Declaration
public static float ToSingle(byte[] value, long startIndex, BitConverterEx.ByteOrder from, BitConverterEx.ByteOrder to)
Parameters
Returns
Type |
Description |
System.Single |
|
|
Improve this Doc
View Source
ToUInt16(Byte[], Int64)
Converts the given array of bytes to a 16-bit unsigned integer.
Declaration
public ushort ToUInt16(byte[] value, long startIndex)
Parameters
Type |
Name |
Description |
System.Byte[] |
value |
|
System.Int64 |
startIndex |
|
Returns
Type |
Description |
System.UInt16 |
|
|
Improve this Doc
View Source
ToUInt16(Byte[], Int64, BitConverterEx.ByteOrder, BitConverterEx.ByteOrder)
Converts the given array of bytes to a 16-bit unsigned integer.
Declaration
public static ushort ToUInt16(byte[] value, long startIndex, BitConverterEx.ByteOrder from, BitConverterEx.ByteOrder to)
Parameters
Returns
Type |
Description |
System.UInt16 |
|
|
Improve this Doc
View Source
ToUInt32(Byte[], Int64)
Converts the given array of bytes to a 32-bit unsigned integer.
Declaration
public uint ToUInt32(byte[] value, long startIndex)
Parameters
Type |
Name |
Description |
System.Byte[] |
value |
|
System.Int64 |
startIndex |
|
Returns
Type |
Description |
System.UInt32 |
|
|
Improve this Doc
View Source
ToUInt32(Byte[], Int64, BitConverterEx.ByteOrder, BitConverterEx.ByteOrder)
Converts the given array of bytes to a 32-bit unsigned integer.
Declaration
public static uint ToUInt32(byte[] value, long startIndex, BitConverterEx.ByteOrder from, BitConverterEx.ByteOrder to)
Parameters
Returns
Type |
Description |
System.UInt32 |
|
|
Improve this Doc
View Source
ToUInt64(Byte[], Int64)
Converts the given array of bytes to a 64-bit unsigned integer.
Declaration
public ulong ToUInt64(byte[] value, long startIndex)
Parameters
Type |
Name |
Description |
System.Byte[] |
value |
|
System.Int64 |
startIndex |
|
Returns
Type |
Description |
System.UInt64 |
|
|
Improve this Doc
View Source
ToUInt64(Byte[], Int64, BitConverterEx.ByteOrder, BitConverterEx.ByteOrder)
Converts the given array of bytes to a 64-bit unsigned integer.
Declaration
public static ulong ToUInt64(byte[] value, long startIndex, BitConverterEx.ByteOrder from, BitConverterEx.ByteOrder to)
Parameters
Returns
Type |
Description |
System.UInt64 |
|