我有两个属性Data
和int Value
对象int Width
。
我有list<Data> DataList
。
我有byte[] Result
。
我需要像这样处理这个列表:
foeach(var data in DataList)
{
var byteData = BitConverter.GetBytes(data.Value); //result 4 bytes length a
//Than i need to copy bits starting from hight (left) from byteData to Result, equal to data.Width.
//So if DataList have 2 elements: DataList[0] with Value = 11101000 00000000 00000000 00000000 and Width = 5
// and DataList[1] with Value = 11000111 11011000 00000000 00000000 and Width = 9
//result should be 11101110 00111100
}