Is Valid Index in IList - CSharp System.Collections.Generic

CSharp examples for System.Collections.Generic:IList

Description

Is Valid Index in IList

Demo Code



public class Main{
        public static bool IsValidIndex(System.Collections.IList collection, int index)
        {//from  w ww.jav  a2  s  .c o  m
            if(null != collection &&
                0 <= index &&
                index < collection.Count &&
                null != collection[index])
            {
                return true;
            }
            else
            {
                return false;
            }
        }
}

Related Tutorials