
{filelink=17568}
using System;
using System.Reflection;
public class InstanceType : MarshalByRefObject
{
public void PrintDomain()
{
Console.WriteLine("Exécution de l'objet dans AppDomain {0}",AppDomain.CurrentDomain.FriendlyName);
}
}
class ExampleUtilisation
{
public static void Main()
{
InstanceType TypeInstanceLocal = new InstanceType();
TypeInstanceLocal.PrintDomain();
AppDomain ad = AppDomain.CreateDomain("Nouveau Domaine");
InstanceType remoteInstanceType = (InstanceType) ad.CreateInstanceAndUnwrap(Assembly.GetExecutingAssembly().FullName,"InstanceType");
remoteInstanceType.PrintDomain();
}
}