In C# is there any way to know the number of non null elements in an array?
-
As length property give complete number of elements in the array. But if only i want to know count of only not null values elements of the array what should be the method or property need to be used. Thanks in Advance. :doh:
I don't think there's anything built in, so you'd probably have to iterate through the entire collection and keep a count yourself.
"On one of my cards it said I had to find temperatures lower than -8. The numbers I uncovered were -6 and -7 so I thought I had won, and so did the woman in the shop. But when she scanned the card the machine said I hadn't. "I phoned Camelot and they fobbed me off with some story that -6 is higher - not lower - than -8 but I'm not having it." -Tina Farrell, a 23 year old thicky from Levenshulme, Manchester.