![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
|
Thread-Topic: Class.FromType ignores assembly information thread-index: AcSRBuiW7pw9/HvsQ+KnSJCNPxWy5Q== X-WBNR-Posting-Host: 168.230.33.10 From: "=?Utf-8?B?R3JlZ0w=?=" <GregL (AT) discussions (DOT) microsoft.com Subject: Class.FromType ignores assembly information Date: Thu, 2 Sep 2004 09:07:13 -0700 Lines: 18 Message-ID: <1AD6715D-DEE9-432C-B057-B67BF2B048E8 (AT) microsoft (DOT) com MIME-Version: 1.0 Content-Type: text/plain; charset="Utf-8" Content-Transfer-Encoding: 7bit X-Newsreader: Microsoft CDO for Windows 2000 Content-Class: urn:content-classes:message Importance: normal Priority: normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 Newsgroups: microsoft.public.dotnet.vjsharp NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29 Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.vjsharp:6437 X-Tomcat-NG: microsoft.public.dotnet.vjsharp If I execute the following code - Assembly a1 = Assembly.LoadFrom("c:\\classLoader\\test\\classx.d ll"); Type type1 = a1.GetType("temp.Classx"); Class cl1 = Class.FromType(type1); Assembly a2 = Assembly.LoadFrom("c:\\classLoader\\test\\testx.dl l"); Type type2 = a2.GetType("temp.Classx"); Class cl2 = Class.FromType(type2); I would expect that cl2 is the temp.Classx in assembly a2. However, if I inspect the __corType.Assembly for cl2, it references assembly a1, even though type2 correctly references assembly a2. It appears that Class.FromType looks for the first loaded class with the matching type, regardless of the assembly reference in the Type class being passed as an argument. Is there an alternative (that works) approach to accessing the correct Class? |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |