using System;
namespace S7.Net.Types
{
///
/// Contains the methods to convert from bytes to byte arrays
///
public static class Byte
{
///
/// Converts a byte to byte array
///
public static byte[] ToByteArray(byte value)
{
return new byte[] { value }; ;
}
///
/// Converts a byte array to byte
///
///
///
public static byte FromByteArray(byte[] bytes)
{
if (bytes.Length != 1)
{
throw new ArgumentException("Wrong number of bytes. Bytes array must contain 1 bytes.");
}
return bytes[0];
}
}
}