C# Singleton Form pattern, how to run 2 and more forms? [closed]

It is the Singleton pattern, meaning you can only get a SINGLE object. If you want to get N* objects, then just remove it from being a singleton and call the constructor.

If you really want, you could create some sort of hybrid static that allows you to set the max number of instances that could be returned.

public static int MaxInstances;
public static List<MyObject> instanceList;
public static MyObject GetInstance()
{
    //Fill the instance list up to the MaxInstances
}

However, managing this is going to be difficult and probably cause bugs. You might be able to pass back the index of the instance I guess, and then request instances by index also. But, again, this seems really error prone and you should just use instances like normal

Leave a Comment