|
|
|
|
|
Wednesday, 06 October 2010 15:15 |
// description of your code here
public sealed class Animal
{
public string Name { get; private set; }
public Func GetSound { get; private set; }
private Animal(string name, Func getSound)
{
Name = name;
GetSound = getSound;
}
public static readonly Animal Dog = new Animal("dog", () => "woof");
public static readonly Animal Eagle = new Animal("eagle", () => "scree");
public static readonly Animal Dolphin = new Animal("dolphin", () => "ee ee");
public static readonly Animal Spider = new Animal("spider", () => "(no sound)");
}
and your "switch" code becomes
public void MakeSound(Animal animal)
{
Console.WriteLine(animal.GetSound());
}
 Read more: |
|
Friday, 24 September 2010 12:00 |
|

The squidcat is, with the exception of some monkeys, the most playful animal in existence. Read more: |
|
|
Monday, 10 May 2010 07:00 |
 | About Animal Saver
A fine collection of animal pictures encased in a screensaver. Bring the wild animal kingdom to your desktop. Includes 60 photos. For the animals’ names go to the screen saver Resources folder. |
Read more: |
|
|
|
|
|