Solved

Reflection and UserControls

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

746 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now