12345678910111213141516 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace Aitex.Core.Util
- {
- [Serializable]
- public class Singleton<T> where T : class, new()
- {
- private static readonly Lazy<T> lazy =
- new Lazy<T>(() => new T(), true);
- public static T Instance => lazy.Value;
- }
- }
|