Beispiel #1
0
        public static void FirstDemo()
        {
            int extrinsicstate = 22;

            FlyWeightFactory factory = new FlyWeightFactory();

            // Work with different flyweight instances

            FlyWeight fx = factory.GetFlyWeight("X");

            fx.Operation(--extrinsicstate);

            FlyWeight fy = factory.GetFlyWeight("Y");

            fy.Operation(--extrinsicstate);

            FlyWeight fz = factory.GetFlyWeight("Z");

            fz.Operation(--extrinsicstate);

            UnsharedConcreteFlyweight fu = new

                                           UnsharedConcreteFlyweight();

            fu.Operation(--extrinsicstate);

            // Wait for user

            Console.ReadKey();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            FlyWeight flyWeight = Factory.CreateInstance(1);

            Console.ReadKey();
        }