Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / August 2005

Tip: Looking for answers? Try searching our database.

getting a type from the class name

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Andy Fish - 25 Aug 2005 18:42 GMT
Hi,

If I want to get a reference to a type given its name, it seems it either
has to be in the same assembly, or I have to know the assembly name. Is
there no way to simply look at all running assemblies for a type of that
name?

Basically I'm looking for the equivalent of Java's Class.ForName() and I
don't understand why there doesn't seem to be one.

TIA

Andy
Jon Skeet [C# MVP] - 25 Aug 2005 19:25 GMT
> If I want to get a reference to a type given its name, it seems it either
> has to be in the same assembly, or I have to know the assembly name. Is
[quoted text clipped - 3 lines]
> Basically I'm looking for the equivalent of Java's Class.ForName() and I
> don't understand why there doesn't seem to be one.

Well, there isn't quite the same ClassLoader idea as in Java. An
AppDomain is similar, but not quite the same.

Anyway, you can ask an Assembly for all its referenced assemblies, and
then load each of those which hasn't already been loaded, and ask each
in turn for the type you're after.

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.