Using system; using system. collections. generic; using system. LINQ; using system. text; namespace simple factory mode {public class simplefactory {// if this function is changed to static, it is changed to static factory method public iproduct createproduct (string productname) {Switch (productname) {Case "producta": return New producta (); Case "prodcutb": return New productb (); default: Throw new exception ("product creation error! ") ;}} Public interface iproduct {void mustdosomething ();} public class producta: iproduct {public producta () {} public void mustdosomething () {// Service Logic of product A} public class productb: iproduct {public productb () {} public void mustdosomething () {// business logic of product B} public class appclient {public static void main (string [] ARGs) {simplefactory afactory = new simplefactory (); iproduct producta = afactory. createproduct ("producta"); producta. mustdosomething (); // call the method iproduct productb = afactory of product. createproduct ("prodcutb"); productb. mustdosomething (); // call the method of product B }}}