Search code examples
.netgenerics.net-4.0

.NET 4.0: Is it possible to call ConvertAll for IList<>?


'ConvertAll' is not implemented for IList, Am I right? Is there any workaround?


Solution

  • IList<T> does not define a method called ConvertAll(). You can see the definition here: http://msdn.microsoft.com/en-us/library/5y536ey6.aspx

    There is a method on the concrete implementation List<T>; http://msdn.microsoft.com/en-us/library/73fe8cwf.aspx

    You can replicate this behaviour using the LINQ statement .Select().