Click here to Skip to main content
15,886,067 members
Articles / Programming Languages / C# 3.5

Adding Post-commit Hook to SVN Source Control

Rate me:
Please Sign up or sign in to vote.
4.50/5 (2 votes)
27 Jul 2012CPOL3 min read 27.1K   135   11  
How to add a post-commit hook to SVN source control that sends email to the team

namespace SampleProj
{
    /// <summary>
    /// This file demonstrates one of the uses of interfaces. Here, it shows how to keep code loosely coupled and easily extendable and maintainable.
    /// </summary>

    public enum AnimalType
    {
        Cat,
        Dog
    }

    public class PetAnimals
    {
        IFoodCost _foodCost;

        public PetAnimals(AnimalType animalType)
        {
            // Create IFoodCost object based on animal type that was sent to this class. Instantiation can be 
            // done in many other ways too like using something like Entierprise Library's unity application block

            switch (animalType)
            {
                case AnimalType.Cat:
                    _foodCost = new Cat();
                    break;
                case AnimalType.Dog:
                    _foodCost = new Dog();
                    break;
            }
        }

        public decimal GetFoodCost()
        {
            return _foodCost.GetFoodCost();
        }
    }

    interface IFoodCost
    {
        decimal GetFoodCost();
    }

    public class Dog : IFoodCost
    {

        public decimal GetFoodCost()
        {
            return 5M;
        }
    }

    public class Cat : IFoodCost
    {
        public decimal GetFoodCost()
        {
            return 10M;
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Employed (other)
Netherlands Netherlands
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions