Click here to Skip to main content
15,897,718 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
How do I get class names and namespaces from dll file?


What I have tried:

I have searched but didn't get anything.
Posted
Updated 16-Apr-22 0:36am

1 solution

Depends what type of DLL it is - if it's an "original" DLL then it's not directly usable by VB or any other .NET language: you have to use DLLImport or provide a wrapper class to use it. That can get complex as the datatypes aren't the same in the original C++ and .NET.

If it's a .NET assembly, you can use ILDASM.EXE which is installed with VS in the folder:
C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.2 Tools
                                              ^
                                              | 
                                               --- May be different from here for you - check.

And loading the DLL into the app.
 
Share this answer
 
Comments
Keyur Raval 2022 18-Apr-22 6:39am    
Is there any code that we can write in Visual Studio and get the class names of particular dll file? I am very new to coding and need aasistance.

I got below code from web but I do not know how to add Assembly ref to the code.
//Read the dll.
Assembly assembly = Assembly.LoadFrom(@"E:\test.dll");

//Get the list of class name .
Type[] types = assembly.GetTypes();

List<string> classname = new List<string>();
foreach (Type t in types)
{
classname.Add(t.Name);
}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900