没啥好说的,直接上代码吧

public class Singleton<T> where T : new()
{
    private static readonly object syslock = new object();

    public static T _instance;

    public static T instance
    {
        get
        {
            if (_instance == null)
            {
                lock (syslock)
                {
                    if (_instance == null)
                    {
                        _instance = new T();
                    }
                }
            }
            return _instance;
        }
    }
}