tampsystems
asked on
collection in the .net framework
We would like to know the best practices for using collection in the .net framework. We have the following two collections, what are the pros and cons for each. One is a non generic collection and one is generic colleciton. Would it be best pracices to use the generic colleciton all the time?
public class PhoneCollection : CollectionBase
{
public void Add(PhoneNumber obj)
{
this.List.Add(obj);
}
public void Remove(PhoneNumber obj)
{
this.List.Remove(obj);
}
}
public class PhoneCollection : List<PhoneNumber>
{
}
public class PhoneCollection : CollectionBase
{
public void Add(PhoneNumber obj)
{
this.List.Add(obj);
}
public void Remove(PhoneNumber obj)
{
this.List.Remove(obj);
}
}
public class PhoneCollection : List<PhoneNumber>
{
}
ASKER
what is a good reason to use the non-generic version?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you are interested in performance and type safety, I'd recommend the generic version.