S
Stephanie Yao via .NET 247
Hi, I've done something on the conversion between int32 and byte[],here is my code:
1, I convert byte[] to an int:
int regInt = BitConverter.ToInt32(regBytes, 0);
this.tbRID.Text = regInt.ToString;//show int to the textbox
2, I convert the int back to byte[]:
int regInt = int.Parse(this.tbRID.Text);//get int from the textbox
byte[] regBytes = BitConverter.GetBytes(regInt);
But I found some data missed. The regBytes.Length should be 32, but here it's only 4.
Hope someone could help me.
1, I convert byte[] to an int:
int regInt = BitConverter.ToInt32(regBytes, 0);
this.tbRID.Text = regInt.ToString;//show int to the textbox
2, I convert the int back to byte[]:
int regInt = int.Parse(this.tbRID.Text);//get int from the textbox
byte[] regBytes = BitConverter.GetBytes(regInt);
But I found some data missed. The regBytes.Length should be 32, but here it's only 4.
Hope someone could help me.