© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
1 reply
Pearl (asyncmeow)

IEnumerable<T> (or List<T>, or T[]) to IEnumerable (non-generic, ie. no type param)?

Hello,
I'm working on some code that takes an
object
object
that may be either an object
T
T
itself, or some form of an
IEnumerable<T>
IEnumerable<T>
. The thing is, I don't actually know
T
T
in this context (as it's a asp.net
IActionFilter
IActionFilter
). How would I check if that object is an
IEnumerable
IEnumerable
and if it is, get the object as that
IEnumerable
IEnumerable
to iterate over it?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Implementing IEnumerable<T>
C#CC# / help
3y ago
❔ Need guidance on generics, List, IEnumerable
C#CC# / help
3y ago
✅ Getting generic type parameters using reflection
C#CC# / help
3y ago