Index Of byte array - CSharp System

CSharp examples for System:Byte Array

Description

Index Of byte array

Demo Code


using System.Text;
using System;/*www  . j  a v a 2  s  .c o  m*/

public class Main{
        public static int IndexOf(this byte[] array, byte b, int skip = 0, int arrayLength = -1)
        {
            if (arrayLength < 0)
            {
                arrayLength = array.Length;
            }
            for (int i = skip; i < arrayLength; i++)
            {
                if (array[i] == b)
                {
                    return i;
                }
            }
            return -1;
        }
}

Related Tutorials