mirror of
https://github.com/digital-jellyfish/Virtu.git
synced 2024-11-23 19:30:59 +00:00
19 lines
567 B
C#
19 lines
567 B
C#
|
using System.Diagnostics.CodeAnalysis;
|
|||
|
|
|||
|
namespace Jellyfish.Library
|
|||
|
{
|
|||
|
public static class SingletonFactory<T> where T : class, new()
|
|||
|
{
|
|||
|
[SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypes")]
|
|||
|
public static T Create()
|
|||
|
{
|
|||
|
return _instance;
|
|||
|
}
|
|||
|
|
|||
|
[SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypes")]
|
|||
|
public static T Instance { get { return _instance; } }
|
|||
|
|
|||
|
private static readonly T _instance = new T();
|
|||
|
}
|
|||
|
}
|