IList and IReadOnlyList

You are out of luck here. IList<T> doesn’t implement IReadOnlyList<T>. List<T> does implement both interfaces, but I think that’s not what you want.

However, you can use LINQ:

  • The Count() extension method internally checks whether the instance in fact is a collection and then uses the Count property.
  • The ElementAt() extension method internally checks whether the instance in fact is a list and than uses the indexer.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)