title: List of alphabet sort to display vertically
body: <p>I have a list, containing the alphabet.</p>
  
  <p>When outputting with foreach, i will currently receive this result:</p>
  
  <ul>
  <li>A B C</li>
  <li>D E F</li>
  <li>G H I</li>
  </ul>
  
  <p>What i would like to achieve is this</p>
  
  <ul>
  <li>A D G</li>
  <li>B E H</li>
  <li>C F I</li>
  </ul>
  
  <p>Ive tried the following, but really, i doesent find it a good or stable solution - and the letters/indexes are presented twice.</p>
  
  <pre><code>        @{
              var ie = 0;
              int sortI = 0;
  
  }
              int columns = 3;
              int dictLength = ToShow.Count();
              int rows = dictLength/columns;
  
              int sortS = 1;
              List&lt;int&gt; hasKey = new List&lt;int&gt;();
  
              var newDict = new Dictionary&lt;string, List&lt;LoopItem&gt; &gt;();
  
  
              if( sort.Equals("alphabetically") )
              {
  
                  while( sortI &lt;= rows )
                  {
  
                          &lt;text&gt;Column @( ToShow.Keys.ElementAt(sortI) ) - &lt;/text&gt;
  
                          while( sortS &lt;= ( columns ) )
                          {           
                                  int index = (( sortS *  columns ) + sortI); //(( sortS *  columns ) + ( 1 + sortI ));
  
                                  if( hasKey.Contains(index) ) { continue; } else
                                  {
  
                                      &lt;text&gt;Column @( ToShow.Keys.ElementAt(index) ) - &lt;/text&gt;
                                      sortS++;
                                      hasKey.Add(index);
                                  }
                          }
                              &lt;text&gt;&lt;br /&gt;&lt;/text&gt;
                          sortS = 1;
                          sortI++;
                  }
  
                  sortS = 1;
                  sortI = 1;
                  &lt;text&gt;&lt;hr /&gt;&lt;/text&gt;
                  foreach( var item in ToShow )
                  {
                          &lt;text&gt;&lt;br/&gt;::Række 1::&lt;br /&gt;&lt;/text&gt;
                      while( columns &gt;= sortS )
                      {
                              &lt;text&gt;Indsæt @(sortI+sortS)&lt;br /&gt;&lt;/text&gt;
                              sortS++;
                      }
  
                      sortI++;
                      sortS = 1;
                  }
  
              }
  
          }
  </code></pre>
  
  <p>Are there any algorithm for this kind of stuff? Or a simple function?</p>
  
  <p>Thanks in advance</p>