I'm working on my first app, which is designed to be a to do list app. I'm a little new to all this so I hope this question isn't too much of a nuisance. I'm trying to build some code to check a string array for null. Here's the code I have
int checkForNull(string[] a, int arrayNum)
{
for (int x = -1; x < arrayNum ; x ++ )
{
if (a[x].Length == 0)
//^^ This is a problem for some reason
{
return (x);
}
}
return (-1);
}
I'm trying to parse an array and return the first integer number that comes back as null. It's part of what I'm using to add new categories to my app. The error I'm receiving comes up on 'if (a[x].Length == 0)' "Array index is out of range". I've also tried 'if (a[x] == null)' but received the same error. Any ideas?
Thanks.