Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

How to get generic list

$
0
0

I would to build a function which should return a collection of childen with given type:

repetitive code like this

IEnumerable<ComboBox> collection = panel.Children.OfType<ComboBox>();

IEnumerable<TextBox> collection = panel.Children.OfType<TextBox>();

should transform in something like

static IEnumerable GetCollection(T type)
{
return panel.Children.OfType<type>();
}

Is this possible? 





Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>