1 // Compiler options: -langversion:linq
2 // Tests variable type inference with the var keyword when using the foreach statement with an array
4 using System.Collections;
10 string [] strings = new string [] { "Foo", "Bar", "Baz" };
11 foreach (var item in strings)
12 if (item.GetType() != typeof (string))
15 int [] ints = new int [] { 2, 4, 8, 16, 42 };
16 foreach (var item in ints)
17 if (item.GetType() != typeof (int))