首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

咋判断当前是否存在某个对象的实例?该怎么处理

2012-02-13 
咋判断当前是否存在某个对象的实例?如题。[解决办法]如果你是想知道 类被实例化 了 多少个?可以试试using S

咋判断当前是否存在某个对象的实例?
如题。

[解决办法]
如果你是想知道 类被实例化 了 多少个?
可以试试

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication4
{
public class test
{
public static int icount = 0;
public test()
{
icount++;
}

~test()
{
icount--;
}
}
class Program
{
static void Main(string[] args)
{
test a = new test();
test b = new test();
test c = new test();

Console.WriteLine(test.icount);
}
}
}
}

热点排行