I have a class:
public class Header
{
public int Width { get; set; }
public int Height { get; set; }
public byte BitDepth { get; set; }
public byte ColorType { get; set; }
public byte CompressionMethod { get; set; }
public byte FilterMethod { get; set; }
public byte InterlaceMethod { get; set; }
}
And array of bytes:
byte[] data = {0, 0, 0, 1, 0, 0, 0, 2, 3, 4, 5, 6, 7};
Bytes directly correspond to values in class eg. Height equals 2 and BitDepth equals 3. Is there any easy way to convert this array to an object or I just have to parse individual values using BitConverter? I've tried to use serialization but it seems that classes contain more information than just field values.