Search code examples
c#design-patternsdecoratorstrategy-pattern

Design pattern usage


I have the following design:

  • I create a class containing properties (like a very big array)
  • Later when I parse the file I want some 'extra parameters/functionality' added, based on the content of the properties in above.

What is the best solution?

  1. Derive a class with the extra parameters/functionality (problem: need to copy the big array to the new class)
  2. Decorator pattern? Or is a decorator not meant for adding extra properties/functions?
  3. Strategy pattern? Since I need properties likely not usable.
  4. Another solution?

Solution

  • You can create a class for AdditionalValues, add one instance to your array and when you need the new values you can set them to the given object.