Exemple #1
0
        static void Main(string[] args)
        {
            int extrinsicstate = 22;

            FlyweightFactory f  = new FlyweightFactory();
            Flyweight        fx = f.GetFlyweight("X");

            fx.Operation(--extrinsicstate);
            Flyweight fy = f.GetFlyweight("Y");

            fy.Operation(--extrinsicstate);
            Flyweight fz = f.GetFlyweight("Z");

            fz.Operation(--extrinsicstate);
            UnsharedConcreteFlyweight uf = new UnsharedConcreteFlyweight();

            uf.Operation(--extrinsicstate);
        }
Exemple #2
0
        static void Main(string[] args)
        {
            int extrinsicstate = 22;

            FlyweightFactory f = new FlyweightFactory();

            Flyweight fx = f.GetFlyweight("X");
            fx.Operation(--extrinsicstate);

            Flyweight fy = f.GetFlyweight("Y");
            fy.Operation(--extrinsicstate);

            Flyweight fz = f.GetFlyweight("Z");
            fz.Operation(--extrinsicstate);

            UnsharedConcreteFlyweight uf = new UnsharedConcreteFlyweight();

            uf.Operation(--extrinsicstate);

            Console.Read();
        }
Exemple #3
0
 public void operation(UnsharedConcreteFlyweight outState)
 {
     Console.WriteLine("具体享元" + key + "被调用,");
     Console.WriteLine("非享元信息是:" + outState.getInfo());
 }