linux-packaging-mono/mcs/tests/gtest-iter-10.cs
Jo Shields a575963da9 Imported Upstream version 3.6.0
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
2014-08-13 10:39:27 +01:00

31 lines
456 B
C#

using System;
using System.Collections.Generic;
class Test
{
static IEnumerable<int> FromTo (int from, int to)
{
while (from <= to) yield return from++;
}
public static int Main ()
{
IEnumerable<int> e = FromTo (1, 10);
int i = 0;
foreach (int x in e) {
foreach (int y in e) {
i += y;
Console.Write ("{0,3} ", x * y);
}
Console.WriteLine ();
}
Console.WriteLine (i);
if (i != 550)
return i;
return 0;
}
}