enterprisecounter.cs
来自「用于c#.net数据库操作的类库。能把结婚集以数组的形成操作。」· CS 代码 · 共 50 行
CS
50 行
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 + =
减小字号Ctrl + -
显示快捷键?