// Collection of code snippets by Arne Vajhøj // (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) using System; namespace X { public static class MyExtensionsOne { public static void A(this int v) { Console.WriteLine("A: " + v); } } public static class MyExtensionsTwo { public static void B(this int v) { Console.WriteLine("B: " + v); } } } namespace Y { public static class MyExtensionsThree { public static void C(this int v) { Console.WriteLine("C: " + v); } } public static class MyExtensionsFour { public static void D(this int v) { Console.WriteLine("D: " + v); } } } namespace E { using X; using static Y.MyExtensionsThree; public class Program { public static void Main(string[] args) { int v = 123; v.A(); v.B(); v.C(); /* Does not compile: v.D(); */ } } }