Skip to content

Instantly share code, notes, and snippets.

@pawndev
Created January 10, 2018 21:59
Show Gist options
  • Save pawndev/65336179ab90b777cfe02347c4410cc6 to your computer and use it in GitHub Desktop.
Save pawndev/65336179ab90b777cfe02347c4410cc6 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Text;
namespace PawnLib.Utils
{
public interface IStore
{
}
public class Store // implement Store with the Command Pattern
{
}
public sealed class StoreContainer
{
private static readonly Lazy<StoreContainer> lazy = new Lazy<StoreContainer>(() => new StoreContainer());
public static StoreContainer Instance { get { return lazy.Value; } }
private Dictionary<string, Store> Collections { get; set; }
public StoreContainer()
{
this.Collections.Add("Default", new Store());
}
public StoreContainer Add(string name, Store newStore)
{
this.Collections.Add(name, newStore);
return this;
}
public Store Get(string name)
{
return this.Collections[name];
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment