// 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.Reflection; namespace E { public class Data { private readonly int v; public Data(int v) { this.v = v; } public int V { get { return v; } } } public class Program { public static void Main(string[] args) { Data o = new Data(123); Console.WriteLine(o.V); FieldInfo fi = o.GetType().GetField("v", BindingFlags.NonPublic | BindingFlags.Instance); fi.SetValue(o, 456); Console.WriteLine(o.V); } } }