I´ve got an byte array where variouse bits have a meanings. Now I´m wondering if I should use the interpreter pattern to define the array´s meaning and the pattern builds some dto´s out of the definition.
new Interpreter(arr)
.Interpret("B0.01", ref MyObject.MyValue)
.Interpret("B0.02", ref MyObject.SecondValue);
I´m unsure if its the best solution. May someone tell if there is a similiar project on the net or maybe a better solution? I´m using C# .net-framework 4.6.1
[EDIT]
For example I´ve got the following Byte-Array
var arr = new[] { 0b00010010, 0b11100101, aso...}
Now a documentation may say:
Byte 0, Bit 0 -> Person has blue hair
Byte 0, Bit 1 -> Person owns a house
Byte 1, Bit 7 -> The house is gray
Now I want parse from this array maybe two objects as following
public class Person
{
public bool HasBlueHair { get; }
public bool OwnsHouse { get; }
}
public class House
{
public bool IsGray { get; }
}
I thought maybe the interpreter pattern is a good solution for this purpose but I´m not very familiar with it, so I need some help.
byte[] array = new byte[] {0x0A, 0x0B, 0x00, 0x12}what is the desired result?[Flags]enum)