1. Gets the instance object of the generic type in the collection
list<t>= list. GetType (). GetGenericArguments (); foreach (var in types) { System.Activator.CreateInstance (type);} Although it is an array, it seems to have only one value here, so object obj =system.activator.createinstance (types. First ());
//you can then get the properties of the class to do some thingsvarProperties =typedescriptor.getproperties (obj); for(vari =0; I < properties. Count; i++){ varproperty =Properties[i]; //If the field has [Display (name = "Phone")] or [DisplayName ("name")] attribute, the DisplayName is displayed first, and if all is blank the field name is displayed varDisplayAttribute = property. attributes[typeof(DisplayAttribute)] asDisplayAttribute; stringColumnName = property. DisplayName = =Property . Name? (DisplayAttribute = =NULL?Property . Name:displayAttribute.Name): property. DisplayName;}
Some code snippets for C #