SetData, GetData : AppDomain : Development Class C# Source Code


Custom Search

C# Source Code » Development Class » AppDomain »

 

SetData, GetData








    
 

using System; 
using System.Reflection;
using System.Collections;

class ListModifier{
    public ListModifier()
    {
        ArrayList list = (ArrayList)AppDomain.CurrentDomain.GetData("Pets");
        list.Add("turtle");
    }
}
class MainClass{
      public static void Main(){
          AppDomain domain = AppDomain.CreateDomain("Test");

          ArrayList list = new ArrayList();
          list.Add("dog");
          list.Add("cat");
          list.Add("fish");

          domain.SetData("Pets", list);

          domain.CreateInstance("MainClass","Apress.VisualCSharpRecipes.Chapter03.ListModifier");

          foreach (string s in (ArrayList)domain.GetData("Pets")) {
              Console.WriteLine(s);
          }
      }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Development Class
» AppDomain