linux-packaging-mono/mcs/tests/test-pattern-01.cs
Xamarin Public Jenkins (auto-signing) 536cd135cc Imported Upstream version 5.4.0.167
Former-commit-id: 5624ac747d633e885131e8349322922b6a59baaa
2017-08-21 15:34:15 +00:00

42 lines
483 B
C#

using System;
class TypePattern
{
public static int Main ()
{
object o = 3;
bool r = o is System.String t1;
if (r)
return 2;
if (o is string t2)
return 3;
long? l = 5;
bool r3 = l is long t4;
if (!r3)
return 8;
Console.WriteLine ("ok");
return 0;
}
static void Test1 (object arg)
{
while (arg is int b) {
b = 2;
}
}
static string Test2 (object arg)
{
if (arg is string s) {
return s;
} else {
s = "";
}
return s;
}
}