You've already forked linux-packaging-mono
Imported Upstream version 5.10.0.47
Former-commit-id: d0813289fa2d35e1f8ed77530acb4fb1df441bc0
This commit is contained in:
parent
88ff76fe28
commit
e46a49ecf1
38
mcs/tests/test-pattern-12.cs
Normal file
38
mcs/tests/test-pattern-12.cs
Normal file
@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
class X
|
||||
{
|
||||
public static int Main ()
|
||||
{
|
||||
foreach (var x in Test1 ("2"))
|
||||
{
|
||||
Console.WriteLine (x);
|
||||
return 1;
|
||||
}
|
||||
|
||||
foreach (var x in Test2 (2))
|
||||
{
|
||||
Console.WriteLine (x);
|
||||
return 2;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static IEnumerable<object> Test1 (object expr)
|
||||
{
|
||||
if (expr is short list)
|
||||
{
|
||||
yield return "list.Length";
|
||||
}
|
||||
}
|
||||
|
||||
public static IEnumerable<object> Test2 (object expr)
|
||||
{
|
||||
if (expr is string list)
|
||||
{
|
||||
yield return "list.Length";
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user