Struct Endian
Representation and convenience methods associated with endianness.
Inherited Members
Namespace: FellowOakDicom.IO
Assembly: fo-dicom.core.dll
Syntax
public struct Endian
Fields
Big
Big endian.
Declaration
public static readonly Endian Big
Field Value
Type | Description |
---|---|
Endian |
Little
Little endian.
Declaration
public static readonly Endian Little
Field Value
Type | Description |
---|---|
Endian |
LocalMachine
Endianness of the local machine, according to System.BitConverter.IsLittleEndian.
Declaration
public static readonly Endian LocalMachine
Field Value
Type | Description |
---|---|
Endian |
Network
Network endian (big).
Declaration
public static readonly Endian Network
Field Value
Type | Description |
---|---|
Endian |
Methods
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
Overrides
Swap(Double)
Swap byte order in System.Double value.
Declaration
public static double Swap(double value)
Parameters
Type | Name | Description |
---|---|---|
System.Double | value | Value in which bytes should be swapped. |
Returns
Type | Description |
---|---|
System.Double | Byte order swapped value. |
Swap(Int16)
Swap byte order in System.Int16 value.
Declaration
public static short Swap(short value)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | value | Value in which bytes should be swapped. |
Returns
Type | Description |
---|---|
System.Int16 | Byte order swapped value. |
Swap(Int16[])
Swap byte order in array of System.Int16 values.
Declaration
public static void Swap(short[] values)
Parameters
Type | Name | Description |
---|---|---|
System.Int16[] | values | Array of System.Int16 values. |
Swap(Int32)
Swap byte order in System.Int32 value.
Declaration
public static int Swap(int value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | value | Value in which bytes should be swapped. |
Returns
Type | Description |
---|---|
System.Int32 | Byte order swapped value. |
Swap(Int32[])
Swap byte order in array of System.Int32 values.
Declaration
public static void Swap(int[] values)
Parameters
Type | Name | Description |
---|---|---|
System.Int32[] | values | Array of System.Int32 values. |
Swap(Int64)
Swap byte order in System.Int64 value.
Declaration
public static long Swap(long value)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | value | Value in which bytes should be swapped. |
Returns
Type | Description |
---|---|
System.Int64 | Byte order swapped value. |
Swap(Single)
Swap byte order in System.Single value.
Declaration
public static float Swap(float value)
Parameters
Type | Name | Description |
---|---|---|
System.Single | value | Value in which bytes should be swapped. |
Returns
Type | Description |
---|---|
System.Single | Byte order swapped value. |
Swap(UInt16)
Swap byte order in System.UInt16 value.
Declaration
public static ushort Swap(ushort value)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | value | Value in which bytes should be swapped. |
Returns
Type | Description |
---|---|
System.UInt16 | Byte order swapped value. |
Swap(UInt16[])
Swap byte order in array of System.UInt16 values.
Declaration
public static void Swap(ushort[] values)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16[] | values | Array of System.UInt16 values. |
Swap(UInt32)
Swap byte order in System.UInt32 value.
Declaration
public static uint Swap(uint value)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | value | Value in which bytes should be swapped. |
Returns
Type | Description |
---|---|
System.UInt32 | Byte order swapped value. |
Swap(UInt32[])
Swap byte order in array of System.UInt32 values.
Declaration
public static void Swap(uint[] values)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32[] | values | Array of System.UInt32 values. |
Swap(UInt64)
Swap byte order in System.UInt64 value.
Declaration
public static ulong Swap(ulong value)
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | value | Value in which bytes should be swapped. |
Returns
Type | Description |
---|---|
System.UInt64 | Byte order swapped value. |
Swap<T>(T[])
Swap byte order in array of values.
Declaration
public static void Swap<T>(T[] values)
Parameters
Type | Name | Description |
---|---|---|
T[] | values | Array of values to swap. |
Type Parameters
Name | Description |
---|---|
T | Array element type, must be one of System.Int16, System.UInt16, System.Int32 or System.UInt32. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | if array element type is not System.Int16, System.UInt16, System.Int32 or System.UInt32. |
SwapBytes(Int32, Byte[])
Swap bytes in sequences of bytesToSwap
.
Declaration
public static void SwapBytes(int bytesToSwap, byte[] bytes)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | bytesToSwap | Number of bytes to swap. |
System.Byte[] | bytes | Array of bytes. |
SwapBytes(Int32, Byte[], Int32)
Swap bytes in sequences of bytesToSwap
.
Declaration
public static void SwapBytes(int bytesToSwap, byte[] bytes, int count)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | bytesToSwap | Number of bytes to swap. |
System.Byte[] | bytes | Array of bytes. |
System.Int32 | count | The maximum number of bytes in the array that should be processed |
SwapBytes2(Byte[])
Swap bytes in sequences of 2.
Declaration
public static void SwapBytes2(byte[] bytes)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | bytes | Array of bytes. |
SwapBytes2(Byte[], Int32)
Swap bytes in sequences of 2.
Declaration
public static void SwapBytes2(byte[] bytes, int count)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | bytes | Array of bytes. |
System.Int32 | count | The maximum number of bytes in the array that should be processed |
SwapBytes4(Byte[])
Swap bytes in sequences of 4.
Declaration
public static void SwapBytes4(byte[] bytes)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | bytes | Array of bytes. |
SwapBytes4(Byte[], Int32)
Swap bytes in sequences of 4.
Declaration
public static void SwapBytes4(byte[] bytes, int count)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | bytes | Array of bytes. |
System.Int32 | count | The maximum number of bytes in the array that should be processed |
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |
Overrides
Operators
Equality(Endian, Endian)
Endian equivalence operator.
Declaration
public static bool operator ==(Endian e1, Endian e2)
Parameters
Type | Name | Description |
---|---|---|
Endian | e1 | First Endian object. |
Endian | e2 | Second Endian object. |
Returns
Type | Description |
---|---|
System.Boolean | True if |
Inequality(Endian, Endian)
Endian non-equivalence operator.
Declaration
public static bool operator !=(Endian e1, Endian e2)
Parameters
Type | Name | Description |
---|---|---|
Endian | e1 | First Endian object. |
Endian | e2 | Second Endian object. |
Returns
Type | Description |
---|---|
System.Boolean | True if |