In a method, I get an object
.
In some situation, this object
can be an IList
of "something" (I have no control over this "something").
I am trying to:
- Identify that this object is an
IList
(of something) - Cast the
object
into an "IList<something>
" to be able to get theCount
from it.
For now, I am stuck and looking for ideas.
You can check if your
object
implementsIList
usingis
.Then you can cast your
object
toIList
to get the count.