1public class PluckableList<T> : List<T>{
2 public Array Pluck(string propertyName){
3 Type type = typeof(T);
4 PropertyInfo property = type.GetProperty(propertyName);
5 Array result = Array.CreateInstance(property.PropertyType, this.Count);
6 for(int i=0;i<this.Count;i++){
7 result.SetValue(type.InvokeMember(propertyName, BindingFlags.GetProperty, null, this[i], null), i);
8 }
9 return result;
10 }
11}