Zodiac Sign: ZodiacSign Class

Posted Mon, Jul 6 2009 14:40 by Deborah Kurata

This entry details the implementation of the ZodiacSign class from this example in C#:

public class ZodiacSign
{
    // Properties
    public string Name { get; set; }
    public List<DateRange> DateRanges { get; set; }

    // Constructor
    public ZodiacSign(string name, List<DateRange> dateranges)
    {
        this.Name = name;
        this.DateRanges = dateranges;
    }
}

This example uses the automatically implemented properties feature that was introduced to C# in .NET 3.5 to define the two properties: Name and DateRanges.

The constructor in this example creates a zodiac sign with an appropriate name and set of date ranges.

Enjoy!

Filed under: , , ,

Leave a Comment

(required) 
(required) 
(optional)
(required)