Created
June 16, 2014 05:49
-
-
Save EifelMono/c0d43a59de8216fac875 to your computer and use it in GitHub Desktop.
IInstance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Text; | |
namespace EifelMono | |
{ | |
public interface IInstance<T> | |
{ | |
T Instance { get; } | |
bool Instanced { get; } | |
} | |
public class InstanceHelper<T> where T : class, new() | |
{ | |
public InstanceHelper() | |
{ | |
} | |
private T m_Value = null; | |
public T Value | |
{ | |
get | |
{ | |
if (m_Value == null) | |
m_Value = new T(); | |
return m_Value; | |
} | |
} | |
public bool IsAlive | |
{ | |
get | |
{ | |
return m_Value != null; | |
} | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment