0

In python I can easily do this to see all method for the re module:

   >>> import re
   >>> dir(re)
   ['DEBUG', 'DOTALL', 'I', 'IGNORECASE', 'L', 'LOCALE', 'M', 'MULTILINE', 'S', 'Scanner', 'T', 'TEMPLATE', 'U', 'UNICODE', 'VERBOSE', 'X', '_MAXCACHE', '__all__', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '__version__', '_alphanum', '_cache', '_cache_repl', '_compile', '_compile_repl', '_expand', '_locale', '_pattern_type', '_pickle', '_subx', 'compile', 'copy_reg', 'error', 'escape', 'findall', 'finditer', 'match', 'purge', 'search', 'split', 'sre_compile', 'sre_parse', 'sub', 'subn', 'sys', 'template']

I could do the same for any instance of a given class. Can C# do this?

JacobIRR
  • 8,545
  • 8
  • 39
  • 68

2 Answers2

1

Yes, you can use Reflection for that purpose and use GetMethods() function like

(typeof(yourclass)).GetMethods(BindingFlags.Public|BindingFlags.Instance|BindingFlags.DeclaredOnly);
Rahul
  • 76,197
  • 13
  • 71
  • 125
-2

https://learn.microsoft.com/en-us/dotnet/framework/reflection-and-codedom/viewing-type-information#memberinfo-methodinfo-fieldinfo-and-propertyinfo

This can be done using Reflection. See the link above for documentation.

Spivonious
  • 718
  • 7
  • 20