Created
March 7, 2012 22:09
-
-
Save jamesmanning/1996569 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.Diagnostics; | |
| using System.Linq; | |
| using System.Text; | |
| namespace ConsoleApplication13 | |
| { | |
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| var dict = new Dictionary<string, object> | |
| { | |
| { "123", 123 }, | |
| { "17", "17" }, | |
| { Math.PI.ToString(), Math.PI }, | |
| }; | |
| foreach (var pair in dict) | |
| { | |
| Console.WriteLine(pair); | |
| } | |
| var someString = String.Join(", ", | |
| from pair in dict | |
| where pair.Key.Length > 2 | |
| select String.Format("{0}={1}", pair.Key, pair.Value) | |
| ); | |
| someString = String.Join(", ", | |
| dict | |
| .Where(pair => pair.Key.Length > 2) | |
| .Select(pair => String.Format("{0}={1}", pair.Key, pair.Value)) | |
| ); | |
| Console.WriteLine(someString); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment