I want to create a class that inherits from CollectionBase, but it seems that it does not support LINQ extensions!
Is it still supported? Or is there an alternative solution?
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.
It is still supported, but it is obsolete. You should always prefer to use the collections defined in the
System.Collections.Genericor theSystem.Collections.ObjectModelnamespaces, instead.You can inherit from one of the generic collections to create your own custom, strongly-typed collection, as well. And it will have full support for LINQ, since they already implement
IEnumerable<T>.Either
List<T>orCollection<T>are good options for your case.Avoid the non-generic collections like
CollectionBase,ArrayList, andHashTableif at all possible. There is a performance penalty to using them, and they offer few advantages (if any!) over the generic versions that were introduced in more recent versions of the framework.