how to check if list index is out of range in csharp

Code Example - how to check if list index is out of range in csharp

                
                        if(index >= 0 && index < array.Length)
{
    //it exists
}