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

Popular posts from this blog

sql server - Cannot query correctly (MSSQL - PHP - JSON) -

php - trouble displaying mysqli database results in correct order -

C++ Linked List -