2010-04-03 Jb Evain <jbevain@novell.com>
[mcs.git] / tests / test-var-03.cs
blobe63fc09636d16ca8eeddf3916d9a79868f2fdd5f
2 // Tests variable type inference with the var keyword when using the foreach statement with an array
3 using System;
4 using System.Collections;
6 public class Test
8 static int Main ()
10 string [] strings = new string [] { "Foo", "Bar", "Baz" };
11 foreach (var item in strings)
12 if (item.GetType() != typeof (string))
13 return 1;
15 int [] ints = new int [] { 2, 4, 8, 16, 42 };
16 foreach (var item in ints)
17 if (item.GetType() != typeof (int))
18 return 2;
20 return 0;