Using system;
namespace Pattern {///
System.Collections.Hashtable ht = new System.Collections.Hashtable (); public flyweightFactory () {} public flyweight getinstance (string key) {if (ht [key] == null) {ht.Add (key, new Concerateflyweight ( ));} Return (flyweight) HT [key];
}}} // Enjoyment Mode FlyweightFactory Factory = New FlyweightFactory (); console.writeline ("aaa"). GetHashcode (). Tostring ()); console.writeline (Factory.GetInstance ("BBB") .Gethashcode (). TOSTRING ()); console.writeline (Factory.GetInstance ("aaa"). GetHashcode (). Tostring ());