// 取得元件(包含共用部份的Flyweight) public UnsharedCoincreteFlyweight GetUnsharedFlyweight(string Key, string SharedContent, string UnsharedContent) { // 先取得共用的部份 Flyweight SharedFlyweight = GetFlyweight(Key, SharedContent); // 產出元件 UnsharedCoincreteFlyweight theFlyweight = new UnsharedCoincreteFlyweight(UnsharedContent); theFlyweight.SetFlyweight(SharedFlyweight); // 設定共享的部份 return(theFlyweight); }
// 取得元件(包含共用部份的Flyweight) public UnsharedCoincreteFlyweight GetUnsharedFlyweight(string Key,string SharedContent,string UnsharedContent) { // 先取得共用的部份 Flyweight SharedFlyweight = GetFlyweight(Key, SharedContent); // 產出元件 UnsharedCoincreteFlyweight theFlyweight = new UnsharedCoincreteFlyweight( UnsharedContent); theFlyweight.SetFlyweight( SharedFlyweight ); // 設定共享的部份 return theFlyweight; }