I've IEnumerable<object>
type variable.
IEnumerable<object> items= new object[] { 1, 2, 3 };
What's the best way to check if it's IEnumerable<int>
?
I tried
typeof(IEnumerable<int>).IsAssignableFrom(items.GetType())
typeof(IEnumerable<int>).IsInstanceOfType(items)
items is IEnumerable<int>
But, Re-Sharper complains about them all.
In my case, IEnumerable<object> items
is of type IEnumerable<int>
in most cases. And I wanted to carry out something when it's of type IEnumerable<int>
and something else for other types.