Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get list of C# Classes Names?

Tags:

c#

winforms

I am implementing a syntax highlighter using C# windows forms, and would like to get a list of all names, I know that this should be done manually, adding keywords and names but i was wondering if there is a function in C# that could help me do this.

like image 655
yahya kh Avatar asked Nov 28 '25 02:11

yahya kh


2 Answers

Use reflection.

Assembly.GetAssembly(typeof(MyClass)).GetTypes()
like image 193
UBCoder Avatar answered Nov 30 '25 15:11

UBCoder


You will have to use the reflection to get the names of classes in a dll.

// Using Reflection to get information from an Assembly:
System.Reflection.Assembly o = System.Reflection.Assembly.Load("mscorlib.dll");
var types = o.GetTypes();
like image 35
Asif Mushtaq Avatar answered Nov 30 '25 15:11

Asif Mushtaq



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!