linq - web api - list all data types on a class -
i'm trying list data types on class , after give information client
i know have use gettype. here have @ moment
var variables = typeof(mockclass).gettype() .select(field => field.name) //error: 'type' not contain definition select .tolist(); i'm trying enter inside class, use query select variables name , try data type.. ideas?
try this
var type = typeof(mockclass); var nestedtypes = new list<type>(); var typenames = new list<string>(); var propertiesnames = new list<string>(); foreach(var p in type.getproperties()) { var t = p.propertytype; nestedtypes.add(t); typenames.add(t.name); propertiesnames.add(p.name); }
Comments
Post a Comment