I want to iterate over all existing classes of my project, to list them dynamically. I think I have to use Reflection (like iterating over a class's objects) but I don't know how to iterate over a project's classes!
Thanks
I want to iterate over all existing classes of my project, to list them dynamically. I think I have to use Reflection (like iterating over a class's objects) but I don't know how to iterate over a project's classes!
Thanks
First of all you need your Assembly, you can have your executing assembly or entry assembly or simply loop through dll files beside your application and load them, so far you have an object of type Assembly, then via GetTypes() method you will have a collection of Type that is all types in the assembly.
Assembly myAssembly = Assembly.GetExecutingAssembly();
foreach (Type type in myAssembly.GetTypes())
{
Console.WriteLine(type.FullName);
}