Jo Shields a575963da9 Imported Upstream version 3.6.0
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
2014-08-13 10:39:27 +01:00

44 lines
672 B
C#

// Compiler options: -langversion:default
//
// Use
using System;
using System.Collections;
class X {
static IEnumerable GetIt (int [] args)
{
foreach (int a in args)
yield return a;
}
static IEnumerable GetMulti (int [,] args)
{
foreach (int a in args)
yield return a;
}
public static int Main ()
{
int total = 0;
foreach (int i in GetIt (new int [] { 1, 2, 3})){
Console.WriteLine ("Got: " + i);
total += i;
}
if (total != 6)
return 1;
total = 0;
foreach (int i in GetMulti (new int [,] { { 10, 20 }, { 30, 40}})){
Console.WriteLine ("Got: " + i);
total += i;
}
if (total != 100)
return 2;
return 0;
}
}