title: c# Sorting a List<KeyValuePair<int, string>>
body: <p>In C# I would like to sort a <code>List&lt;KeyValuePair&lt;int, string&gt;&gt;</code> by the length of each string in the list. In Psuedo-Java this would be an anonymous and would look something like:</p>
  
  <pre><code>  Collections.Sort(someList, new Comparator&lt;KeyValuePair&lt;int, string&gt;&gt;( {
        public int compare(KeyValuePair&lt;int, string&gt; s1, KeyValuePair&lt;int, string&gt; s2)
        {
            return (s1.Value.Length &gt; s2.Value.Length) ? 1 : 0;    //specify my sorting criteria here
        }
      });
  </code></pre>
  
  <ol>
  <li>How do I get the above functionality?</li>
  </ol>