Exemple #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?");
 }
Exemple #2
0
 protected bool Equals(Fruit other)
 {
     return(string.Equals(_description, other._description));
 }
Exemple #3
0
 protected bool Equals(Fruit other)
 {
     return string.Equals(_description, other._description);
 }