Strategy Pattern in .NET: Listing 4

Customer Validation Strategy

Listing 4: CustomerValidationStrategy.cs

using System;
namespace VSMStrategyPatternDemo
    public class CustomerValidationStrategy : IPersonValidationStrategy
        public bool IsValid(Person person)
            bool valid = false;
            if (person.FirstName != null && person.LastName != null && person.DateOfBirth < DateTime.Now.AddYears(13))
                valid = true;
            return valid;

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

comments powered by Disqus


.NET Insight

Sign up for our newsletter.

Terms and Privacy Policy consent

I agree to this site's Privacy Policy.

Upcoming Events