30 lines
665 B
C#
30 lines
665 B
C#
|
/********************************************************************
|
||
|
文件: Singleton.cs
|
||
|
作者: 梦语
|
||
|
邮箱: 1982614048@qq.com
|
||
|
创建时间: 2024/03/29 17:28:19
|
||
|
最后修改: 梦语
|
||
|
最后修改时间: 2024/04/03 16:05:58
|
||
|
功能: 单例类
|
||
|
*********************************************************************/
|
||
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
|
||
|
public class Singleton<T> where T : new()
|
||
|
{
|
||
|
private static T instance;
|
||
|
|
||
|
public static T Inst
|
||
|
{
|
||
|
get
|
||
|
{
|
||
|
if (instance == null)
|
||
|
{
|
||
|
instance = new T();
|
||
|
}
|
||
|
|
||
|
return instance;
|
||
|
}
|
||
|
}
|
||
|
}
|