using System;
using System.Collections.ObjectModel;
using System.Collections.Generic;
using System.Linq;
namespace ProgrammerThoughts.Common {
/// <summary>
/// A generic Collection class which ensures that it actually contains generic List.
/// This provides us with an ability to re-use any public method of List<T>
/// with a simple shell function. Such a shell could be implemented in ListColection<T>.
/// or in a concrete implermentation.
/// </summary>
public class ListCollection<T> : Collection<T>
where T : class {
public ListCollection()
: base(new List<T>()) {
}
/// <summary>
/// You can implement such shell methods in your concrete implementations of this generic instead.
/// </summary>
/// <param name="match">An actual function of type Predicate<T></param>
/// <returns></returns>
public T Find(Predicate<T> match) {
List<T> items = (List<T>)Items;
return items.Find(match);
}
}
}