你可以创建一个类,类里面实现单例,然后把你要的属性放在类里,这样全局就可以用了,而且是唯一的 单例如下: 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; } } } 这样就可以实现你的目的
testReply
110,533
社区成员
642,574
社区内容
加载中
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧