Virtu/Library/SingletonFactory.cs
Sean Fausett eaaab47a6c Initial checkin.
--HG--
extra : convert_revision : svn%3Affd33b8c-2492-42e0-bdc5-587b920b7d6d/trunk%4019155
2009-05-22 14:37:50 +00:00

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();
}
}