C#C
C#3y ago
Matt

❔ Array.IndexOf being weird

I'm very confused. Been trying to use Array.IndexOf to find a null terminator in a byte array
int endOfString = Array.IndexOf(Data, 0x0, EntryNameTableOffset + entry.NameTableOffset);

But it fails to find the byte and returns -1

Doing this however, it finds the byte... O_O
Why does Array.IndexOf not work in this situation?
for (int x = EntryNameTableOffset + entry.NameTableOffset; x < Data.Length; x++)
{
    if (Data[x] == 0x0)
    {
        endOfString = x;
        break;
    }
}
Was this page helpful?