예제 #1
0
 public Product GetProduct()
 {
     return(objectBuilder.GetProduct());
 }
예제 #2
0
        /// <summary> ANOTHER WAY TO CREATE SINGELTON WITHOUT LOCK

        // public sealed class Singleton
        // {

        //    private static readonly Singleton instance = new Singleton();

        //    Explicit static constructor to tell C# compiler
        //    not to mark type as beforefieldinit

        //    static Singleton()
        //    {
        //    }

        //    private Singleton()
        //    {
        //    }

        //    public static Singleton Instance
        //    {
        //        get
        //        {
        //            return instance;
        //        }
        //    }
        // }
        /// </summary>


        public Product Build(IProductBuilder builder)
        {
            builder.setName("bla");
            builder.setNumber(10);
            return(builder.GetProduct());
        }