2 // Tests variable type inference with the var keyword when using the foreach statement with generic collections
4 using System
.Collections
.Generic
;
10 string[] strings
= new string[] { "Foo", "Bar", "Baz" }
;
12 foreach (var v
in strings
)
13 if (v
.GetType () != typeof (string))
16 Dictionary
<int, string> dict
= new Dictionary
<int, string> ();
21 foreach (var v
in dict
)
22 if (v
.GetType () != typeof (KeyValuePair
<int, string>))