Example #1
0
        public void InHere(AppDomainArgs args)
        {
            Console.WriteLine("In MEF Library1: AppDomain: {0}, args.StringArg: {1}",
                              AppDomain.CurrentDomain.FriendlyName,
                              args.StringArg);

            args.StringArg = "Leaving MEF Library1";
            Console.WriteLine("Library1 args set to {0}", args.StringArg);
        }
Example #2
0
    static void Main()
    {
        AppDomain        domain   = AppDomain.CreateDomain("Domain666");
        MyBoundaryObject boundary = (MyBoundaryObject)
                                    domain.CreateInstanceAndUnwrap(
            typeof(MyBoundaryObject).Assembly.FullName,
            typeof(MyBoundaryObject).FullName);

        AppDomainArgs ada = new AppDomainArgs();

        ada.myString = "abc";
        Console.WriteLine("Before: " + ada.myString);
        boundary.SomeMethod(ada);
        Console.WriteLine("After: " + ada.myString);
        Console.ReadKey();
        AppDomain.Unload(domain);
    }
Example #3
0
 public AppDomainArgs AppDomainArgHandler()
 {
     // Initialize our AppDomainArgs.
     if (AppDomain.CurrentDomain.FriendlyName != "Host_AppDomain")
     {
         return(null);
     }
     if (appDomainArgs == null)
     {
         Console.WriteLine("Initializing instance of appDomainArgs in in AppDomain {0}", AppDomain.CurrentDomain.FriendlyName);
         appDomainArgs = new AppDomainArgs {
             StringArg = "Args initialized"
         };
         return(appDomainArgs);
     }
     appDomainArgs.StringArg = string.Format("Run through AppDomainArgHandler in AppDomain {0}", AppDomain.CurrentDomain.FriendlyName);
     Console.WriteLine(appDomainArgs.StringArg);
     return(appDomainArgs);
 }
Example #4
0
 public void SomeMethod(AppDomainArgs ada)
 {
     Console.WriteLine(AppDomain.CurrentDomain.FriendlyName + "; executing");
     ada.myString = "working!";
 }