2 using System
.ComponentModel
;
3 using System
.Runtime
.Remoting
;
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
{
32 get { return default(T2); }
35 public virtual int getInt () {
39 public virtual string getTypeNames
<T3
> () {
44 public class Something
<T1
, T2
> : Other
<T1
,T2
> {
45 public override int getInt () {
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 ();