Example:
System.Web.Security.MembershipCollection implements IEnumerable and not IEnumberable<T>. Why doesn’t it implement the latter, when it seems that it would be better (e.g. use LINQ)?
Or, is it not necessarily better?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use LINQ with any
IEnumerableby using theCast<T>()function or theOfType<T>()function. If you’re confident that theIEnumerableonly contains objects of a particular type, thenCast<T>()will be slightly faster.For example,
There are many existing classes (like
ArrayList) that existed before the advent of generics in .NET, so they are still non-generic.