Skip to content

Instantly share code, notes, and snippets.

@EifelMono
Created June 16, 2014 05:49
Show Gist options
  • Save EifelMono/c0d43a59de8216fac875 to your computer and use it in GitHub Desktop.
Save EifelMono/c0d43a59de8216fac875 to your computer and use it in GitHub Desktop.
IInstance
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