title: VB.NET Get Keys by sorted Values in Hashtable
body: <p>I am studying VB.NET and I want to know better idea to get Keys by sorted values in Hashtable</p>
  
  <p>Here is my solution that I built </p>
  
  <pre><code>  Dim int_Value As Integer() = New Integer() {-9, 2, 8, 6, 8, 1, -9}
          Dim int_Key As Integer() = New Integer() {1, 2, 3, 4, 5, 6, 7}
          Dim Dum_Int(int_Key.Length) As Integer
  
          Dim STORE_KEYS As New ArrayList
          Array.Copy(int_Value, Dum_Int, Dum_Int.Length - 1)
          Array.Sort(Dum_Int)
          Array.Reverse(Dum_Int)
  
          For I = 0 To Dum_Int.Length - 1
              For II = 0 To int_Value.Length - 1
                  If Dum_Int(I) = int_Value(II) Then
                      STORE_KEYS.Add(int_Key(II))
                      int_Value(II) = Integer.MaxValue
                  End If
              Next
          Next
  </code></pre>
  
  <p>I got output like..</p>
  
  <blockquote>
    <p>'' OUTPUT''</p>
    
    <ul>
    <li>(0) 3 {Integer} Object</li>
    <li>(1) 5 {Integer} Object</li>
    <li>(2) 4 {Integer} Object</li>
    <li>(3) 2 {Integer} Object</li>
    <li>(4) 6 {Integer} Object</li>
    <li>(5) 1 {Integer} Object</li>
    <li>(6) 7 {Integer} Object</li>
    </ul>
  </blockquote>
  
  <p>I assume that I have Hashtable.</p>
  
  <p>I create two arrays and store both Keys (int_Key) and Values(Int_Value) From Hashtable</p>
  
  <p>then I copy Value(Int_Value) array to Dum_Int to sort values</p>
  
  <p>Whenever I found matching int value between Sorted Array and Original Value Array</p>
  
  <p>I stored in to STORE_KEYS(arraylist) and I insert Max Int value to original array to prevent overlapping issue.</p>
  
  <p>However, is there any way to improve this method ?</p>
  
  <p>I don't believe that better sorting algor can't help to simplify this method.</p>
  
  <p>Can you provide any hints to  simplify this method?</p>
  
  <p>thanks</p>