c# - Getting all methods of a target class at runtime -


this question has answer here:

is there way me returned list of methods of target class in form of array of strings @ runtime in c# other parsing documentation class? want emulate ide's suggesting methods types code segment.

so method work (ideally) so:

getmethods(foo.gettype())

and returned list of foo's methods.

using system; using system.linq;  namespace consoleapplication1 {     class someclass     {         public void a() { }         public void b() { }         public void c() { }         public void d() { }         public void e() { }         public void f() { }     }      class program     {         static void main()         {             var methods = getmethods(typeof (someclass));              foreach (var methodname in methods)             {                 console.writeline(methodname);             }         }          private static string[] getmethods(type type)         {             var methods = type.getmethods();             return methods.select(m => m.name).toarray();         }     } } 

Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -