using System;
using System.Runtime.Remoting.Contexts;
using System.Threading;
public class MyClass
{
public MyClass()
{
Context ctx = Thread.CurrentContext;
Console.WriteLine("{0} object in context {1}", this.ToString(), ctx.ContextID);
foreach(IContextProperty itfCtxProp in ctx.ContextProperties)
Console.WriteLine("-> Ctx Prop: {0}", itfCtxProp.Name);
}
}
public class MyClassTS : ContextBoundObject
{
public MyClassTS()
{
Context ctx = Thread.CurrentContext;
Console.WriteLine("{0} object in context {1}",this.ToString(), ctx.ContextID);
foreach (IContextProperty itfCtxProp in ctx.ContextProperties)
Console.WriteLine("-> Ctx Prop: {0}", itfCtxProp.Name);
}
}
class Program
{
static void Main(string[] args)
{
MyClass sport = new MyClass();
MyClass sport2 = new MyClass();
MyClassTS synchroSport = new MyClassTS();
}
}