- Get link
- X
- Other Apps
A fairly simple example of the multiton pattern, with a private constructor, and a tracker for created objects, the name being an integer identifier. Salient Chacteristic(s) A private keyed list for tracking objects A private constructor Named objects Code using System.Collections.Generic; using System.Linq; namespace DesignPatterns { public class Multiton { //read-only dictionary to track multitons private static IDictionary<int, Multiton> _Tracker = new Dictionary<int, Multiton> { }; private Multiton() { } public static Multiton GetInstance(int key) { //value to return Multiton item = null; ...