using System;
using System.Linq;
class ImplicitlyTypedLocals2
{
static void Main()
{
string[] words = { "aPPLE", "BlUeBeRrY", "cHeRry" };
// If a query produces a sequence of anonymous types,
// then use var in the foreach statement to access the properties.
var upperLowerWords =
from w in words
select new { Upper = w.ToUpper(), Lower = w.ToLower() };
// Execute the query
foreach (var ul in upperLowerWords)
{
Console.WriteLine("Uppercase: {0}, Lowercase: {1}", ul.Upper, ul.Lower);
}
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uTGlucTsKCmNsYXNzIEltcGxpY2l0bHlUeXBlZExvY2FsczIKewogICAgc3RhdGljIHZvaWQgTWFpbigpCiAgICB7CiAgICAgICAgc3RyaW5nW10gd29yZHMgPSB7ICJhUFBMRSIsICJCbFVlQmVSclkiLCAiY0hlUnJ5IiB9OwoKICAgICAgICAvLyBJZiBhIHF1ZXJ5IHByb2R1Y2VzIGEgc2VxdWVuY2Ugb2YgYW5vbnltb3VzIHR5cGVzLCAKICAgICAgICAvLyB0aGVuIHVzZSB2YXIgaW4gdGhlIGZvcmVhY2ggc3RhdGVtZW50IHRvIGFjY2VzcyB0aGUgcHJvcGVydGllcy4KICAgICAgICB2YXIgdXBwZXJMb3dlcldvcmRzID0KICAgICAgICAgICAgIGZyb20gdyBpbiB3b3JkcwogICAgICAgICAgICAgc2VsZWN0IG5ldyB7IFVwcGVyID0gdy5Ub1VwcGVyKCksIExvd2VyID0gdy5Ub0xvd2VyKCkgfTsKCiAgICAgICAgLy8gRXhlY3V0ZSB0aGUgcXVlcnkKICAgICAgICBmb3JlYWNoICh2YXIgdWwgaW4gdXBwZXJMb3dlcldvcmRzKQogICAgICAgIHsKICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIlVwcGVyY2FzZTogezB9LCBMb3dlcmNhc2U6IHsxfSIsIHVsLlVwcGVyLCB1bC5Mb3dlcik7CiAgICAgICAgfQogICAgfQp9