public void ExplicitPropertiesAreHidden() { ExplicitCounter counter = new ExplicitCounter(); Assert.AreEqual(0, counter.Get()); // counter.First() / counter.First NOT accessable !!! Assert.AreEqual(typeof(Func <int>), counter.Get.GetType()); Func <int, string> g; // Add 1 counter.Inc(1); Assert.AreEqual(1, counter.Get()); // Add 2 counter.Inc(2); Assert.AreEqual(3, counter.Get()); }
public void IncrementCounterInLoop() { for (ExplicitCounter counter = new ExplicitCounter(); counter.Get() < 10; counter.Inc(1)) { Console.Out.WriteLine(counter.Get()); } }