I'm a Java developer, making a transition to working in C#. I'm familiar with the following pattern -- abstract method or interface implemented by each Enum
member -- in Java:
public enum Animal {
CAT {
public String makeNoise() { return "meow!"; }
},
DOG {
public String makeNoise() { return "woof!"; }
};
public abstract String makeNoise();
}
and I am wondering if (a) this pattern is possible in C# and (b) whether this is a Csharpy (do people say that?) thing to do. (I don't have my ide setup yet, and concede I should be able to try this out on my own. But it is interesting that I have had a hard time finding an example of this pattern for C# on the internet). Thanks!