-3
I have the following string:
gxAjaxKey = "FF00FFFFFFFF2426FFFFFF046448FF70"
I must take 2 elements at a time from this string and convert to byte:
FF = 255
00 = 0
FF = 255
.
.
.
70 = 112
I wrote the following code :
int GxAjaxKeyLength = gxAjaxKey.Length;
for(int i=0; i < GxAjaxKeyLength; i += 2)
{
var a = gxAjaxKey.Substring(i, i + 2);
mainArray[(i/2)] = Convert.ToByte(a, 16);
}
The problem is that in the second interaction, instead of getting 00 I’m getting 00FF. I’m not seeing where my mistake is.