mardi 7 février 2017

What is the purpose of this "pattern"?

A class C implements an interface I, so it implements all the methods and properties declared in the interface.

The class has a data member which is a dictionary of pairs of string key and an object of any class implementing the same interface.

Is this a design pattern?

What is the purpose of this "pattern", whether it is indeed a pattern?

Thanks.

For example,

public class MySingleton : IMyInterface 
{

     private static MySingleton _instance = new MySingleton();

    private SortedDictionary<string, IMyInterface> _dictionary = new SortedDictionary<string, IMyInterface>();


    public static IMyInterface GetQuery (string name)
    {
        return _instance[name];
    }

    #Implementing IMyInterface's Methods and Properties
    ...
}

Aucun commentaire:

Enregistrer un commentaire