using System; using System.Linq; using System.Reflection; namespace SO16515341 { class RestMethods { static void Main() { Console.WriteLine(A.Test); A.Clear(); Console.WriteLine(A.Test); } public static void ClearAllStaticValues(Type t) { var varList = t.GetFields(BindingFlags.NonPublic | BindingFlags.Static); varList.Where(x => x.FieldType == typeof(Int32)).ToList().ForEach(x => x.SetValue(null, 0)); } } public class A { private static int test = 100; public static int Test { get { return test; } } public static void Clear() { //static member RestMethods.ClearAllStaticValues(typeof(A)); } public void ClearInstance() { //instance member RestMethods.ClearAllStaticValues(GetType()); } } }