title: Adding a break to a bubble sort in case the array is already sorted
body: <p>I currently have a (somewhat messy) bubble sort of an object array called "sorted", the code is as follows</p>
  
  <pre><code>object storage = 0;
  for (int i = 0; i &lt; sorted.Length; i++)
  {
      for (int c = 0; c &lt; sorted.Length - 1; c++)
      {
          if (sorted[c].ToString().CompareTo(sorted[c + 1].ToString()) &gt; 0)
          {
              storage = sorted[c + 1];
              sorted[c + 1] = sorted[c];
              sorted[c] = storage;
          }
      }
      return sorted;
  </code></pre>
  
  <p>Problem is that this function always loops through the array , no matter what. Hypothetically speaking the "sorted" array could be a large array and just so happen to be sorted already, in which case the function would still scan the array and work for some time, which I want to prevent.
  So the question is, how do I stop the loop properly in case the array is sorted already?</p>