// Collection of code snippets by Arne Vajhøj // (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) using System; public class Data1 { public int Iv { get; set; } public string Sv { get; set; } } public class Data2 { public int Iv { get; } public string Sv { get; } public Data2(int xiv, string xsv) // necessary since there are no setters { Iv = xiv; Sv = xsv; } } public class IOP8 { public static void Main(string[] args) { Data1 o1 = new Data1 { Iv = 123, Sv = "ABC" }; // possible to change o1 here Console.WriteLine($"{o1.Iv} {o1.Sv}"); Data2 o2 = new Data2(123, "ABC"); Console.WriteLine($"{o2.Iv} {o2.Sv}"); } }