What is the need for Flyweight Pattern in C#?If your application
includes many primitive objects, then sharing them efficiently will be
a tough task. This sharing of primitive objects is achieved using Flyweight
pattern in C#.
You can share these primitive objects as many times as required by different set of Clients. This is demonstrated using the following code snippet: class sampleFlyweightGrouping { You can have your own method definitions for sampleFlyweightClass and then create a testClass. Inside Main method of testClass, create an instance of sampleFlyWeightGrouping. With this instance, you can call fetchPrimitiveObject for each of the primitive objects appended and then call appropriate methods of this object.
|