Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ImplicitlyTypedLocals
- {
- 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);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement