473,394 Members | 1,746 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Question on Assembly.GetType()

Hey guys,

Here is my scenario:
I have a form and two dlls, call them ClassLibrary1.dll and Interfaces.dll.
In my form I have the following:

private Assembly m_assembly;
private Type m_type;
m_assembly = Assembly.LoadFrom("ClassLibrary1.dll");
m_type = m_assembly.GetType("ClassLibrary1.Class2");

Class2 is defined in ClassLibrary.dll.

Now, Interfaces.dll contains an interface I want Class2 to implement. If I
have Class2 implement the interface from Interfaces.dll but do not have
Interfaces.dll in the same directory as ClassLibrary1.dll when I call
GetType, the result is null.

If I define the interface in ClassLibrary1.dll itself or place the
Interfaces.dll in the same directory as ClassLibrary1.dll, GetType correctly
returns the type.

Why does GetType require that whatever file defines an interface that the
type you are checking for implements to be present? Couldn't GetType just
return "Class2" without caring what interfaces it implements?

Thanks.
Nov 1 '06 #1
0 2915

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Neo | last post by:
Does anyone know how to get a list of the types in an Assembly without actually loading the Assembly into your app domain?
2
by: david.kao | last post by:
I have web service always return a string in Xml format, and I have the code at client side translates this return string into correct value. For example: my web service returns a <ret...
1
by: Zachary Hartnett | last post by:
I was trying to write a routine this morning that would open a given assembly, walk the inheritance tree of classes in the assembly, and provide a list of classes in the assembly that inherit from...
26
by: Vish | last post by:
Hi, I am trying to expose my .NET 2.0 class as a COM type using the following attributes for the attributes I have the "Register for COM Interop" build property set to true. I also have...
12
by: Antony | last post by:
Hello - I am wanting to print out a "Yes" next to classes that implement "Interface01", otherwise a "No". Here is my code. It crashes with a null reference exception and I am not sure why. Ideas?...
4
by: Andre Nogueira | last post by:
Hi guys I am developing a plugin-enabled application, and for that I am using reflection. I created an abstract ("MustInherit") class, from which all plugins must inherit. My question is......
2
by: Craig Buchanan | last post by:
I would like to have a string representation of my classes type and assembly in format of full name, assembly. Me.GetType() gets me the fullname Me.GetType().AssemblyQualifiedName gets me much...
8
by: rowe_newsgroups | last post by:
I know this has to be answered in the archives somewhere, but the search results are just confusing me more :-( Anyways, I authored a control library that contains an Interface definition and...
8
by: Martin Eckart | last post by:
Hi folks, Who can explain me why the following expression does not result in getting the correct type, but null: Type t = Type.GetType("System.Xml.XmlReader"); For "System.String" it works...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.