Created
March 23, 2017 15:44
-
-
Save ufcpp/e03bab3173b3eb48f2cc45760a610730 to your computer and use it in GitHub Desktop.
is var と is T の違い…
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
using System; | |
class Program | |
{ | |
static void Main() | |
{ | |
string s = null; | |
if(s is var x) | |
{ | |
// ここには来る | |
Console.WriteLine("aaa " + x); | |
} | |
if (s is string y) | |
{ | |
// ここには来ない… | |
Console.WriteLine("bbb " + y); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment