title: How to sort array of strings by their lengths
body: <p>I have an array of strings such as "blue", "green", "red" and I wish to sort them so the longest string comes first and the shortest last.</p>
  
  <p>Currently I am creating another array with the lengths of each string in the array in the same index positions and using this array as the key array to sort by as can be seen below, but I think this could be optimised into one line perhaps?</p>
  
  <pre><code>Dim colours() As string = {"blue", "green", "red"}
  Dim colourslength() As Integer
  For i As Integer = 0 To colours.Length - 1
   colourslength(i) = colours(i).Length
  Next
  Array.Sort(colourslength, colours)
  Array.Reverse(colours)
  </code></pre>
  
  <p>Edit: just realised I defined colours as a list in the example code, it's an array in my actual code.</p>