public static byte[] GetBytes(ulong value) { byte[] buffer = System.BitConverter.GetBytes(value); if (System.BitConverter.IsLittleEndian) { NetworkConverter.Reverse(buffer); } return(buffer); }
public static ushort ToUInt16(byte[] value, int offset) { if (value == null) { throw new ArgumentNullException("value"); } if (value.Length < 2) { throw new ArgumentOutOfRangeException("value"); } if ((value.Length - offset) < 2) { throw new ArgumentOutOfRangeException("offset"); } if (System.BitConverter.IsLittleEndian) { return(System.BitConverter.ToUInt16(NetworkConverter.GetReverse(value, offset, 2), 0)); } else { return(System.BitConverter.ToUInt16(value, offset)); } }
public static ulong ToUInt64(byte[] value) { return(NetworkConverter.ToUInt64(value, 0)); }
public static uint ToUInt32(byte[] value) { return(NetworkConverter.ToUInt32(value, 0)); }
public static ushort ToUInt16(byte[] value) { return(NetworkConverter.ToUInt16(value, 0)); }
public static double ToDouble(byte[] value) { return(NetworkConverter.ToDouble(value, 0)); }
public static float ToSingle(byte[] value) { return(NetworkConverter.ToSingle(value, 0)); }
public static char ToChar(byte[] value) { return(NetworkConverter.ToChar(value, 0)); }
public static bool ToBoolean(byte[] value) { return(NetworkConverter.ToBoolean(value, 0)); }
public static string ToBase64UrlString(byte[] value) { return(NetworkConverter.ToBase64UrlString(value, 0, value.Length)); }