Hi, Im new to C# and have been assigned a project that involves creating part of an Mpeg2 Packet in C#.
The problem I have is when it comes to bit manipulation and or byte manipulation in order to create the packets. I tried using bitarrays in order to create the packets and am running into problems, especially when I have to convert integer values and put them into specific locations of a given bit array. Also the bit array follows in little endian lsbl.
Everytime I convert an integer I get invalid values...
ex:
int ivalue = 1028;
byte[] myByteArray = System.BitConverter.GetBytes(ivalue);
BitArray news = new BitArray(myByteArray);
the BitArray becomes much larger than I need it to be, I want it to be within 10 bits.
Is there any example on how to create a bit packet?
Am I going about this the right way by using bitarrays? or should I be manipulating Bytes?
My problem with bytes is that, I cannot edit individual bits easilly.
Please Help
Kp