2010-06-17 Geoff Norton <gnorton@novell.com>
[mono.git] / mono / tests / generic-xdomain.2.cs
blob7a08380515b15456028f63ddc538370398c450b9
1 using System;
2 using System.ComponentModel;
3 using System.Runtime.Remoting;
5 namespace Test {
6 public class Test {
7 static void Main ()
9 AppDomain domain = AppDomain.CreateDomain ("new-domain");
10 domain.DoCallBack (Run);
11 Type stType = typeof (Something<string, string>);
12 Other<string, string> st = (Other<string, string>) domain.CreateInstanceAndUnwrap (stType.Assembly.FullName, stType.FullName);
13 Console.WriteLine ("in main int: {0}", st.getInt ());
14 Console.WriteLine ("in main types: {0}", st.getTypeNames<Test> ());
17 public static void Run ()
19 DoRun<string, string>(new Something<string, string> ());
22 public static void DoRun<T1, T2> (Other<T1, T2> some)
24 Console.WriteLine ("domain: {0}", AppDomain.CurrentDomain.FriendlyName);
25 Console.WriteLine ("This is null: {0}", some.Mappings == null);
26 Console.WriteLine ("int: {0}", some.getInt ());
30 public class Other<T1, T2> : MarshalByRefObject {
31 public T2 Mappings {
32 get { return default(T2); }
35 public virtual int getInt () {
36 return 123;
39 public virtual string getTypeNames<T3> () {
40 return "error";
44 public class Something<T1, T2> : Other<T1,T2> {
45 public override int getInt () {
46 return 456;
49 public override string getTypeNames<T3> () {
50 Console.WriteLine ("getTypeNames in {0}", AppDomain.CurrentDomain.FriendlyName);
51 return typeof(T1).ToString () + " " + typeof(T2).ToString () + " " + typeof (T3).ToString ();