* ResolvedReference.cs (.ctor): Set 'OriginalItemSpec' and 'ResolvedFrom',
[mcs.git] / tests / gtest-var-04.cs
blob6f00046efe77ad31e176cc8163e5cd8d5bb60d99
2 // Tests variable type inference with the var keyword when using the foreach statement with generic collections
3 using System;
4 using System.Collections.Generic;
6 public class Test
8 static int Main ()
10 string[] strings = new string[] { "Foo", "Bar", "Baz" };
12 foreach (var v in strings)
13 if (v.GetType () != typeof (string))
14 return 1;
16 Dictionary<int, string> dict = new Dictionary<int, string> ();
17 dict.Add (0, "boo");
18 dict.Add (1, "far");
19 dict.Add (2, "faz");
21 foreach (var v in dict)
22 if (v.GetType () != typeof (KeyValuePair<int, string>))
23 return 2;
25 return 0;