Link to home
Start Free TrialLog in
Avatar of Tom Sage
Tom SageFlag for United States of America

asked on

Best way to remove empty elements from ArrayList?

I would like to remove multiple empty elements from an ArrayList.

What is the best way to do this?  Would prefer VB.NET syntax. Using VS 20008.

Thanks
Avatar of Jens Fiederer
Jens Fiederer
Flag of United States of America image

Pure VB.NET syntax using a loop, or is LINQ OK?
Avatar of Tom Sage

ASKER

Sure, LINQ is ok.


Thanks
ASKER CERTIFIED SOLUTION
Avatar of Jens Fiederer
Jens Fiederer
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Can you give me an example using the List<objectType> ?

Thank you very much.

After the same first line as above,

query.ToList()

gives you a List<Student>

(the original "arrList" doesn't really have to be an ArrayList, it can be any collection)
jensfiederer - Thanks for the quick response, and the excellent code !!