0
public class Singleton<T> where T : Singleton<T>, new()
{
    public static T Instance => _instance;
    private static readonly T _instance = new T();

    static Singleton(){}

    protected Singleton(){}
}

public sealed class UIModelCollection:Singleton<UIModelCollection>
{
    //error CS0310
    private UIModelCollection(){ }
    //Resolve after declaring as public
}

 
What kind of singleton do I use for a constructor with public permissions...  
This is stumping me.  
Now I have to initialize something in the constructor with private permissions.  
How should I write it?

Shao Zhao
  • 13
  • 3

0 Answers0