// 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; namespace E { public class Person { public string Name { get; set; } } public class Foo { public void A(Person p) { Console.WriteLine(p.Name + " called Foo.A"); Console.WriteLine("A"); } public void B(Person p) { Console.WriteLine(p.Name + " called Foo.B"); Console.WriteLine("B"); } } public class Bar { public void C(Person p) { Console.WriteLine(p.Name + " called Bar.C"); Console.WriteLine("C"); } public void D(Person p) { Console.WriteLine(p.Name + " called Bar.D"); Console.WriteLine("D"); } } public class ApplicationLogic { public void DoSomethings() { Person p = new Person { Name="Arne" }; Foo foo = new Foo(); foo.A(p); foo.B(p); Bar bar = new Bar(); bar.C(p); bar.D(p); } } public class Program { public static void Main(string[] args) { ApplicationLogic app = new ApplicationLogic(); app.DoSomethings(); } } }