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

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -