// Collection of code snippets by Arne Vajhøj // (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) using System; using Test; public class MainClass { public static void Main(string[] args) { Console.WriteLine("COM/C# static"); CoTest cotest = new CoTestClass(); ITest test = (ITest)cotest; Console.WriteLine("123 + 456 = {0}", test.Add(123, 456)); Console.WriteLine("123 + default = {0}", test.Add(123)); Console.WriteLine("ABC + XYZ = {0}", test.Concat("ABC", "XYZ")); Console.WriteLine("ABC + default = {0}", test.Concat("ABC")); Console.WriteLine("IV = {0} SV = {1}", test.IV, test.SV); test.IV = 123; test.SV = "ABC"; Console.WriteLine("IV = {0} SV = {1}", test.IV, test.SV); CoTest another = test.Another(); Console.WriteLine("Another 123 + 345 = {0}", another.Add(123, 456)); CoTest cotest2 = new CoTestClass(); ITest2 test2 = (ITest2)cotest2; Console.WriteLine("Sum = {0}", test2.Sum()); Console.WriteLine("Sum 1..5 = {0}", test2.Sum(1, 2, 3, 4, 5)); Console.WriteLine("Sum 1..10 = {0}", test2.Sum(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)); } }