c# - How to check for object of particular type in a HashSet in windows 8? -


i have hashset of generic type usercontrol, can have various usercontrol (login, settings). want check whether set contains object of particular type (say login). if want element.

i know quite easy loop, there better way?

unfortunately, cannot without loop, because need try elements of collection check types. in fact, not matter have hash set: work same list, or other enumerable. however, linq lets hide loop, this:

var item = hashset.oftype<desiredtype>().firstordefault(); 

Popular posts from this blog

Php - Delimiter must not be alphanumeric or backslash -

c# - How to change the "Applies To" field under folder auditing options programatically (.NET) -

c++ - Ambiguity when using boost::assign::list_of to construct a std::vector -