// Collection of code snippets by Arne Vajhøj // (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) using System; namespace E { public readonly struct S { // non readonbly fields not allowed: // public int x; public int A { get; } public int B { get; } public int C { get; } // setters now allowed: // public int D { get; set; } public S(int a, int b, int c) { A = a; B = b; C = c; } public override string ToString() { return string.Format("({0},{1},{2})", A, B, C); } } public class Program { private static S s = new S(1, 2, 3); public static S M() { return s; } public static void Main(string[] args) { S s = M(); Console.WriteLine(s); } } }