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 that may be either an object T itself, or some form of an IEnumerable<T>. The thing is, I don't actually know T in this context (as it's a asp.net IActionFilter). How would I check if that object is an IEnumerable and if it is, get the object as that IEnumerable to iterate over it?
1 Reply
Pearl (asyncmeow)
ahh - i'm dumb. I was thinking I couldn't because I was mistakenly checking against the wrong variable if it was System.Collections.IEnumerable, and it wasn't, so it was returning false.