Last active
September 23, 2018 00:41
-
-
Save avegaraju/d53bccf85e229197c021c854b9b52437 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void PaymentMethod(object o) | |
{ | |
switch (o) | |
{ | |
case string s when s.Contains("CashOnDelivery"): | |
Console.WriteLine("cash on delivery"); | |
break; | |
case Paypal pId when pId.Id != null: | |
Console.WriteLine($"paypal {pId.Id}"); | |
break; | |
case Card card when card.IsValidCardNumber(): | |
Console.WriteLine($"Card {card.Number} - {card.Type}"); | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment