Type forwarding - determine whether a type has been moved to another assembly


hi everybody,

i'm trying out type forwarding. here ist , works.

original code:

// typeforwardtest.exe  type t = typeof(old.myclass);  console.writeline("{0}", t.assembly);    // old.dll  public class myclass  {  }      // output  old, version=1.0.0.0, culture=neutral, publickeytoken=null

now move type 'old.myclass' assembly:

// old.dll  // add reference new.dll  // remove declaration of myclass  [assembly: typeforwardedto(typeof(old.myclass))]    // new.dll  public class myclass  {  }    // output  @new, version=1.0.0.0, culture=neutral, publickeytoken=null
ok, works fine, but: can somehow find out in typeforwardtest.exe myclass has been moved , declared in old.dll?

best regards

laurin

okay big question:

why want figure out @ runtime in wich assembly class resides? defining assemblies done @ compile time. , time matter again when start programm. @ runtime code should not ever care get's it's class from.

possible answer:

other having list of classes, not really. considering "moving classes between assemblies" copying plain text 1 file , hitting build command twice, there no way vs know code came from. less content came from. cannot every store information it.


let's talk mvvm: http://social.msdn.microsoft.com/forums/en-us/wpf/thread/b1a8bf14-4acd-4d77-9df8-bdb95b02dbe2



Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'