Visual Basic (Declaration) | |
---|---|
Public Overloads Sub Increment() |
C# | |
---|---|
public void Increment() |
Library/Library.Test/TestUsageCounter.cs
C# | Copy Code |
---|---|
using (UsageCounter counter = new UsageCounter("some global name")) { Assert.AreEqual(0, counter.InstanceCount); counter.Increment(); Assert.AreEqual(1, counter.InstanceCount); counter.Increment(); Assert.AreEqual(2, counter.InstanceCount); using (UsageCounter copy = new UsageCounter("some global name")) Assert.AreEqual(0, copy.InstanceCount); counter.Decrement(); Assert.AreEqual(1, counter.InstanceCount); counter.Decrement(); Assert.AreEqual(0, counter.InstanceCount); } |
VB.NET | Copy Code |
---|---|
Using counter As New UsageCounter("some global name") Assert.AreEqual(0, counter.InstanceCount) counter.Increment() Assert.AreEqual(1, counter.InstanceCount) counter.Increment() Assert.AreEqual(2, counter.InstanceCount) Using copy As New UsageCounter("some global name") Assert.AreEqual(0, copy.InstanceCount) End Using counter.Decrement() Assert.AreEqual(1, counter.InstanceCount) counter.Decrement() Assert.AreEqual(0, counter.InstanceCount) End Using |
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
Reference
UsageCounter ClassUsageCounter Members
Overload List