I'm coding a program to parse xml to a byte array, and need to check the numeric values at certain indexes within the byte array.
For example if 99 is an integer within the array, it should write an error message to the console, same for 999 and 01.
What I've tried so far is the using a for each loop, but the if..else conditions are checking the index number, not the integer numbers associated with each index in the array.
Does anyone know how I can loop through the integer values associated with each index? (shown in the screen shot below)
This is what I've tried so far, but the loop seems to be checking the index values , not the integer values associated with the indexes, giving false results:
private static byte[] requestBytes;
foreach(char i in requestBytes)
{
if (i == 99)
{
Console.WriteLine("Sending Failure..");
}
else if(i == 999)
{
Console.WriteLine("Message Failure..");
}
else if (i == 01)
{
Console.WriteLine("Sending Success..");
}
}
As you can see in the picture, each index has an associated integer value, which I want to check in a loop.

charinstead ofbyte?arr[i]with a regularforloop