1.Topics‎ > ‎Architecture‎ > ‎Patterns‎ > ‎a.Design Patterns‎ > ‎C.Structural Patterns‎ > ‎

H.Property Map Pattern

  1. Summary 
    1. This pattern is used to simplify and reduce inheritance relationships in between the classes 
    2. It says that if Classes differ only in term of properties then use a Property bag (Key -Value Pair) also called property bag to hold varying properties.
    3. This pattern is based on the design guidelines called "Classes are all about behavior"
    4. Property Bags are also called Extended Properties.
  2. Overview 
    1. http://www.codeproject.com/Articles/12282/Implementing-a-PropertyBag-in-C
  3. When to Use it 
    1. When you have two or more classes that differ only in properties not in behavior then use this pattern to merge then in a single one.
  4. Example 
    1. Guitar class design in which basic properties and behavior are always same but feature number of wire, head color etc differ from instance to instance.
  5. Implementation 
    1.  class Guitar

          {

              /// Guitar Methods

              /// Features

              Dictionary<string, string> Features = new Dictionary<string, string>();

          }