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