Ejemplo n.º 1
0
 private static string DescribeFruit(Fruit fruit)
 {
     // Matching a Fruit value to a string value
     return fruit.Match<Fruit, string>()
         .With(f => f.Description.Length > 20, "That's a long description")
         .With(new Apple("Granny Smith"), "My favorite :)")
         .WithType<Apple>("An apple")
         .WithType<Banana>("A banana")
         .WithNull("Not a fruit")
         .Finally("Huh?");
 }
Ejemplo n.º 2
0
 protected bool Equals(Fruit other)
 {
     return(string.Equals(_description, other._description));
 }
Ejemplo n.º 3
0
 protected bool Equals(Fruit other)
 {
     return string.Equals(_description, other._description);
 }