ByteHelper Class
Namespace: PTS
Assembly: PTSframework.dll
Provides a set of static methods for byte type.
Syntax
public static class ByteHelper
Inheritance
Methods
HexStringToBytes(String)
Converts hexadecimal string to byte array.
Declaration
public static byte[] HexStringToBytes(string input)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | input | The string to convert to bytes. |
Returns
| Type | Description |
|---|---|
| System.Byte[] | Converted |
ToDouble(Byte[])
Converts the byte array to double value.
Declaration
public static double ToDouble(this byte[] bytes)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte[] | bytes | Byte array to convert. |
Returns
| Type | Description |
|---|---|
| System.Double | Converted |
ToHexadecimalString(Byte[])
Converts the byte array to hexadecimal string representation.
Declaration
public static string ToHexadecimalString(this byte[] bytes)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte[] | bytes | Byte array to convert. |
Returns
| Type | Description |
|---|---|
| System.String | Hexadecimal |
ToInt16(Byte[])
Converts the byte array to short value.
Declaration
public static short ToInt16(this byte[] bytes)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte[] | bytes | Byte array to convert. |
Returns
| Type | Description |
|---|---|
| System.Int16 | Converted |
ToInt32(Byte[])
Converts the byte array to int value.
Declaration
public static int ToInt32(this byte[] bytes)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte[] | bytes | Byte array to convert. |
Returns
| Type | Description |
|---|---|
| System.Int32 | Converted |
ToInt64(Byte[])
Converts the byte array to long value.
Declaration
public static long ToInt64(this byte[] bytes)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte[] | bytes | Byte array to convert. |
Returns
| Type | Description |
|---|---|
| System.Int64 | Converted |
ToSingle(Byte[])
Converts the byte array to float value.
Declaration
public static float ToSingle(this byte[] bytes)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte[] | bytes | Byte array to convert. |
Returns
| Type | Description |
|---|---|
| System.Single | Converted |
ToUInt16(Byte[])
Converts the byte array to ushort value.
Declaration
public static ushort ToUInt16(this byte[] bytes)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte[] | bytes | Byte array to convert. |
Returns
| Type | Description |
|---|---|
| System.UInt16 | Converted |
ToUInt32(Byte[])
Converts the byte array to uint value.
Declaration
public static uint ToUInt32(this byte[] bytes)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte[] | bytes | Byte array to convert. |
Returns
| Type | Description |
|---|---|
| System.UInt32 | Converted |
ToUInt64(Byte[])
Converts the byte array to ulong value.
Declaration
public static ulong ToUInt64(this byte[] bytes)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte[] | bytes | Byte array to convert. |
Returns
| Type | Description |
|---|---|
| System.UInt64 | Converted |