Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gtest-iter-10.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6c25baa84a07068cb80154442d5060d0dd550e1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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;
	}
}