public static void Run()
{
Console.WriteLine("This structural code demonstrates the Flyweight pattern in which a relatively small number of objects is shared many times by different clients.");
int extrinsicstate = 22;
FlyweightFactory factory1 = new FlyweightFactory();
Flyweight fx = factory1.GetFlyweight("X");
fx.Operation(--extrinsicstate);
Flyweight fy = factory1.GetFlyweight("Y");
fy.Operation(--extrinsicstate);
Flyweight fz = factory1.GetFlyweight("Z");
fz.Operation(--extrinsicstate);
UnsharedConcreteFlyweight fu = new UnsharedConcreteFlyweight();
fu.Operation(--extrinsicstate);
/*
* ConcreteFlyweight: 21
* ConcreteFlyweight: 20
* ConcreteFlyweight: 19
* UnsharedConcreteFlyweight: 18
*/
}