Solved

Reflection and UserControls

Posted on 2011-03-08
1
252 Views
Last Modified: 2012-05-11
I can use reflection to load an assembly and get all the types but what i cannot do is find any class in the assembly that is a usercontrol.


Can anyone help?
0
Comment
Question by:cossy74
1 Comment
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 500 total points
ID: 35069256
Have you tried something like:
            Assembly asm = Assembly.LoadFile(@"C:\someAssembly.dll");

            Type[] types = asm.GetTypes();
            foreach (Type t in types)
            {
                if (t.BaseType.Equals(typeof(System.Web.UI.UserControl)))
                {
                    Console.WriteLine(t.Name + " is a user control");
                }
            }

Open in new window

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Hey!!!! 1 25
How to read text with RegEx... 2 25
IEnumerable<T> to a List<T> 8 37
VB.NET - Refactor Class per SOLID principles 2 17
In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question