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","Namespace.Namespace.ListModifier");
foreach (string s in (ArrayList)domain.GetData("Pets")) {
Console.WriteLine(s);
}
}
}
|