The Builder Pattern in .NET: Listing 1

Listing 1: Beer.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace VSMBuilderPatternDemo.Builder
{
    public class Beer
    {
        public string Label { get; set; }
        public double Volume { get; set; }
        public double Price { get; set; }
        public double Potency { get; set; }
 
        public override string ToString()
        {
            return String.Format("{0} {1} oz. {2}% ABV {3:C}", Label, Volume, Potency, Price);
        }
    }
}

About the Author

Eric Vogel is a Senior Software Developer for Red Cedar Solutions Group in Okemos, Michigan. He is the president of the Greater Lansing User Group for .NET. Eric enjoys learning about software architecture and craftsmanship, and is always looking for ways to create more robust and testable applications. Contact him at [email protected].

comments powered by Disqus

Featured

Subscribe on YouTube