你可以创建一个类,类里面实现单例,然后把你要的属性放在类里,这样全局就可以用了,而且是唯一的
单例如下:
class test
{
protected test()//外界不能new对象
{}protected test m_instance = null;
public test instance
{
get
{
if(m_instance == null)
m_instance = new test();
return m_instance;
}
}
}这样就可以实现你的目的
单例如下:
class test
{
protected test()//外界不能new对象
{}protected test m_instance = null;
public test instance
{
get
{
if(m_instance == null)
m_instance = new test();
return m_instance;
}
}
}这样就可以实现你的目的
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货