3 using System.Security.Policy;
4 using System.Threading;
5 using System.Runtime.Serialization;
10 public struct c2 : ISerializable {
14 private c2 (SerializationInfo info, StreamingContext context) {
15 a = info.GetInt32("a");
16 s1 = info.GetString("s1");
17 Console.WriteLine ("SetObjectData called: " + info.AssemblyName + "," +
18 info.FullTypeName + " " + s1 + ", " + a);
21 public void GetObjectData (SerializationInfo info, StreamingContext context) {
22 Console.WriteLine ("GetObjectData called: " + info.AssemblyName + "," +
23 info.FullTypeName + " " + s1 + ", " + a);
24 info.AddValue ("a", a);
26 info.AddValue ("s1", s1);
28 info.AddValue ("s1", "(null)");
41 public string s1 = "TEST1";
42 [NonSerialized] public string s2 = "TEST2";
43 public c2 [] sa = new c2 [2];
49 AppDomainSetup setup = new AppDomainSetup ();
50 setup.ApplicationBase = Directory.GetCurrentDirectory ();
51 Console.WriteLine (AppDomain.CurrentDomain.FriendlyName);
53 AppDomain newDomain = AppDomain.CreateDomain ("NewDomain", new Evidence (), setup);
58 newDomain.SetData ("TEST", a1);
59 c1 r1 = (c1)newDomain.GetData ("TEST");
60 if (r1.a != 1 || r1.b !=2)
78 if (r1.sa [0].s1 != "(null)")