Posts Tagged Reflection

Show All Forms In A Project with C#

This will list all forms or other types you specify that are in your particular Visual Studio project. It is a continuation of redoing code I have previously done in for C#. It can come in handy when documenting your code during your project. If it’s a form, do a certain set of actions, a class then do another set of actions and so on.

You can find the version here. There were some changes made from that version.

Have a great day!

           System.Reflection.Assembly myAssembly = System.Reflection.Assembly.GetEntryAssembly();
           Type[] Types = myAssembly.GetTypes();
           foreach (Type myType in Types)
               if (myType.BaseType == null) continue;

               if (myType.BaseType.FullName == “System.Windows.Forms.Form”) MessageBox.Show(myType.Name);

               //else { MessageBox.Show(myType.Name); }      


, , , , , , , , , , , , , , , , , , , ,

Leave a comment