C# 单例模式
2021-05-08 21:27
标签:space mes nbsp ace rgs nta pac code bsp C# 单例模式 标签:space mes nbsp ace rgs nta pac code bsp 原文地址:http://www.cnblogs.com/zhaoxianglong1987/p/7623635.htmlusing System.Windows.Forms;
namespace jjjjjj
{
public partial class Form2 : Form
{
private static Form2 _ins;
private Form2()
{
InitializeComponent();
}
public static Form2 GetSingle()
{
if (_ins==null)
{
_ins=new Form2();
}
return _ins;
}
private void Form2_FormClosing(object sender, FormClosingEventArgs e)
{
if (_ins != null)
{
_ins = null;
}
}
}
}
上一篇:c#生成条形码
下一篇:C#的Class的几个修饰符