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

            var factory    = new FlyweightFactory();
            var flyweightA = factory.GetFlyweight("A");

            flyweightA.StatefulOperation(--extrinsicstate);

            var flyweightB = factory.GetFlyweight("B");

            flyweightB.StatefulOperation(--extrinsicstate);

            var flyweightC = factory.GetFlyweight("C");

            flyweightC.StatefulOperation(--extrinsicstate);

            var unsharedFlyweight = new UnsharedFlyweight();

            unsharedFlyweight.StatefulOperation(--extrinsicstate);
        }
Beispiel #2
0
        static void Main()
        {
            int extrinsicstate = 22;

            var factory = new FlyweightFactory();
            var flyweightA = factory.GetFlyweight("A");
            flyweightA.StatefulOperation(--extrinsicstate);

            var flyweightB = factory.GetFlyweight("B");
            flyweightB.StatefulOperation(--extrinsicstate);

            var flyweightC = factory.GetFlyweight("C");
            flyweightC.StatefulOperation(--extrinsicstate);

            var unsharedFlyweight = new UnsharedFlyweight();
            unsharedFlyweight.StatefulOperation(--extrinsicstate);
        }