Generic c# helper method to convert esri enumerations to list

Discussion created by jasti532 on May 16, 2011
 public delegate T EsriIndexerItemDelegate<T,T1>(T1 esriEnumObject,int index);         public static List<T> EsriIndexerToList<T, T1>(T1 esriEnumObject, int count, EsriIndexerItemDelegate<T, T1> del)         {             List<T> list;             list = new List<T>(/*count*/);             for (int j = 0; j < count; j++)             {                 var field =  del(esriEnumObject,j);                 list.Add(field);             }             return list;         }



Sample usage

 List<IField> fields1 = EsriIndexerToList(srcFclass.Fields, srcFclass.Fields.FieldCount, (fields, index) => fields.get_Field(index));



Hopefully this is useful..