title: Sorting string array in C#
body: <p>Maybe it sounds weird, but after a long time programming, I just got on array sorting. Everything was as I expected, until I tried to sort an array of strings containing two identical strings inside. Let's see:</p>
  
  <p>Suppose having the following:</p>
  
  <pre><code>string[] testArray = new string[]
      {
          "aa",
          "ab",
          "ac",
          "ad",
          "ab",
          "af"
      };
  
  Array.Sort(testArray, StringComparer.InvariantCulture);
  </code></pre>
  
  <p>In this situation I get an array plain of null values. I got that this behavior is because the values inside array are not distinct values. Is there a better explanation for this? How do I sort a non-distinct array?</p>