Created
September 6, 2017 16:08
-
-
Save Blind-Striker/f90e218b9953cf68778851992a20146a to your computer and use it in GitHub Desktop.
C# 7.0 Pattern Matching and Out Example for blog
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 static void ShowUserBalance(object balance) | |
{ | |
if (balance is decimal userBalance || (balance is string s && decimal.TryParse(s, out userBalance))) | |
{ | |
Console.WriteLine($"Kullanıcının bakiyesi {userBalance}"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment