// 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 System.Xml; class MainClass { private static void Test1(int i1) { i1 = 456; } private static void Test2(ref int i2) { i2 = 456; } private static void Test3(string s3) { s3 = "DEF"; } private static void Test4(ref string s4) { s4 = "DEF"; } private static void Test5(XmlDocument xd5) { XmlDocument xd5new = new XmlDocument(); xd5new.LoadXml(""); xd5 = xd5new; } private static void Test6(ref XmlDocument xd6) { XmlDocument xd6new = new XmlDocument(); xd6new.LoadXml(""); xd6 = xd6new; } public static void Main(string[] args) { int i1 = 123; Test1(i1); Console.WriteLine(i1); int i2 = 123; Test2(ref i2); Console.WriteLine(i2); string s3 = "ABC"; Test3(s3); Console.WriteLine(s3); string s4 = "ABC"; Test4(ref s4); Console.WriteLine(s4); XmlDocument xd5 = new XmlDocument(); xd5.LoadXml(""); Test5(xd5); Console.WriteLine(xd5.OuterXml); XmlDocument xd6 = new XmlDocument(); xd6.LoadXml(""); Test6(ref xd6); Console.WriteLine(xd6.OuterXml); } }