codeowners update
[mono.git] / mcs / tests / test-var-03.cs
1
2 // Tests variable type inference with the var keyword when using the foreach statement with an array
3 using System;
4 using System.Collections;
5
6 public class Test
7 {
8         public static int Main ()
9         {
10                 string [] strings = new string [] { "Foo", "Bar", "Baz" };
11                 foreach (var item in strings)
12                         if (item.GetType() != typeof (string))
13                                 return 1;
14                 
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;
19                 
20                 return 0;
21         }
22 }