I have a variable that gets all the values of my xml and I would like to check to see if the index of it is greater than 1.
Here is my variable
var IdList = xmlElements.Attributes("value");
Which will have values in it that look like this:
[0] = {value="akjldshfkjsdhf"}
[1] = {value="wefjafvkjashfk"}
I basically wanna check if the index value will be greater than one. But i am unsure how.
so if the index has more than 1 ID do this
Can someone please help? Thanks!
If you're after the count of the value
elements, you can just use:
var count = IdList.Count();
if (count > 1)
{
...
}
Or if you don't need the count afterwards, you can just see whether there are any left after you've skipped one:
if (IdList.Skip(1).Any())
{
...
}
See more on this question at Stackoverflow