static public void GenerateColumns(ObjectListView olv, IEnumerable enumerable) { // Generate columns based on the type of the first model in the collection and then quit foreach (object model in enumerable) { Generator.GenerateColumns(olv, model.GetType()); return; } // If we reach here, the collection was empty, so we clear the list Generator.ReplaceColumns(olv, new List <OLVColumn>()); }
/// <summary> /// Generate columns into the given ObjectListView that come from the given /// model object type. /// </summary> /// <param name="olv">The ObjectListView to modify</param> /// <param name="type">The model type whose attributes will be considered.</param> static public void GenerateColumns(ObjectListView olv, Type type) { IList <OLVColumn> columns = Generator.GenerateColumns(type); Generator.ReplaceColumns(olv, columns); }