コード例 #1
0
        public UnsharedConcreteFlyweight GetUnsharedFlyweight(string key, string sharedContent, string unsharedContent)
        {
            // 先获取共享部分
            Flyweight sharedFlyweight = GetFlyweight(key, sharedContent);

            // 产生非共享组件
            UnsharedConcreteFlyweight theFlyweight = new UnsharedConcreteFlyweight(unsharedContent);

            // 设置共享部分
            theFlyweight.SetFlyweight(sharedFlyweight);

            return(theFlyweight);
        }