I have a specialized list that holds items of type IThing:
public class ThingList : IList
{...}
public interface IThing
{
Decimal
If using .NET 3.5, why not use lambdas?
public Decimal GetMaximum(Func prop) {
Decimal result = Decimal.MinValue;
foreach (IThing thing in this)
result = Math.Max(result, prop(thing));
return result;
}
Usage:
Decimal result = list.GetMaximum(x => x.Weight);
This is strongly typed and efficient. There are also extension methods that already do exactly this.