I looking for a way to prevent IndexOutOfRangeException when I try to access a specific array index.
I have a generic code that some times has values at array[index], and other times there is not.
so, before trying to get its value I have tried these checks:
if(array[index] != null) {
... Do Stuff
}
Also tried:
if(!String.IsNullOrEmpty(array[index])) {
... Do Stuff
}
They all trows an IndexOutOfRangeException
How could I perform this check?
array?