// 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 A { private int v; public int V { get { return v; } set { v = value; }} public A(int v) { this.v = v; } public void Add(int n) { v += n; } public override string ToString() { return v.ToString(); } } public static class B { public static void Mul(this A o, int n) { o.V *= n; } } public class Program { public static void Main(string[] args) { A o = new A(2); o.Add(1); o.Mul(3); Console.WriteLine(o); } } }