📄 enterprisecounter.cs
字号:
using System;
using System.Collections;
using System.Diagnostics;
namespace EnterpriseObjects
{
public class EnterpriseCounter
{
// members...
public string Name;
public string HelpText;
public PerformanceCounterType Type;
public PerformanceCounter Counter;
private Hashtable _instances = new Hashtable();
public EnterpriseCounter()
{
}
public EnterpriseCounter(string name, string helpText, PerformanceCounterType type)
{
Name = name;
HelpText = helpText;
Type = type;
}
public void RegisterInstance(object theObject)
{
// do we have this object?
int hashCode = theObject.GetHashCode();
if(_instances.Contains(hashCode) == false)
{
_instances.Add(hashCode, null);
Counter.Increment();
}
}
public void DeregisterInstance(object theObject)
{
// get the hashcode...
int hashCode = theObject.GetHashCode();
if(_instances.Contains(hashCode) == true)
{
_instances.Remove(hashCode);
Counter.Decrement();
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -