int[] intsz = new int[] { 1,2,3,22,35 };
byte[]bytes z;
for(int I = 0; Me & ltintsz. Length; i++)
{
Bytesz = bit converter. GetBytes(intsz[I]);
System. Windows.forms.messagebox.show ("byte array:" +string. Add (".",bytes z)););
}
//Method 2: Write data into the stream and process the stream in bytes. You can convert any basic type of array into a byte stream.
int[] intsz2 = new int[] { 13,7,3,22,35 };
byte[]bytes z2;
memory stream ms = new memory stream(); //Create a stream in memory
BinaryWriter bw = new binary writer (ms); //Write an array to the stream through a BinaryWriter.
for(int I = 0; Me & ltintsz2. Length; i++)
bw。 write(intsz 2[I]);
bytes z2 = ms . to array(); //You can directly access the stream in bytes, or you can convert the stream into an array of bytes, here is an array.
System. Windows.forms.messagebox.show ("byte array:" +string. Add ("."bytes z2)););
//Method 3: It is a bit operation, but this is called an array. Relatively speaking, the second method can process the whole array bit by bit, which is more suitable for the problem, so this method is not implemented.
//Pay attention to the byte order of the integers stored in the memory. Through the above code, you can access each byte of the int array in sequence. There may be a more convenient way, but Baidu didn't find it just now.