Solved

Reflection and UserControls

Posted on 2011-03-08
1
251 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

776 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