Check length of list or if it's empty

I’m having trouble finding the length of a list I’m using. I thought if you had a list you could just use listName.Length which would return the number of elements but for some reason I’m not getting that option. It seems like it’s giving me the options for an ienumerable instead of a list (e.g. last, lastindex, longcount).

I’m using add to collection to add strings to the list and need to check if it’s empty before proceeding with the rest of the code.

Any ideas on how to check if it’s empty or not??

For an Array, you can use the .Length property. For Collections, use the .Count property.

6 Likes

Perfect, thank you!!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.