// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using Spring.Context; using Spring.Context.Support; namespace E { public interface I { void WhoAmI(); } public class X : I { private Y myy; public Y Myy { get { return myy; } set { myy = value; } } public void WhoAmI() { Console.WriteLine("I am X with " + myy); } } public class Y { private string s; public string S { get { return s; } set { s = value; } } public override string ToString() { return s; } } public class MainClass { public static void Main(string[] args) { IApplicationContext ctx = ContextRegistry.GetContext(); I o = (I) ctx.GetObject ("XWithY"); o.WhoAmI(); } } }