axiosengine/axios/Engine/Singleton.cs
nathan@daedalus 7d3c8a9f39 + * - Adding properties in DrawableAxiosGameObject to turn on/off the following:
+ *   - AdjustUnits
+ *   - RelativeToCamera
+ * - Cleaning and sorting using statements
2012-03-24 18:06:51 -05:00

30 lines
769 B
C#

using System;
namespace Axios.Engine
{
//http://ralch.wordpress.com/2008/11/22/the-singleton-pattern-how-to-make-it-reusable/
//http://msdn.microsoft.com/en-us/library/ff650316.aspx
public abstract class Singleton<T> where T: new()
{
private static T instance;
private static object syncRoot = new Object();
public static T Instance
{
get
{
if (instance == null)
{
lock (syncRoot)
{
if (instance == null)
instance = new T();
}
}
return instance;
}
}
}
}