title: ReverseString, a C# interview-question
body: <p>I had an interview question that asked me for my 'feedback' on a piece of code a junior programmer wrote. They hinted there may be a problem and said it will be used heavily on large strings. </p>
  
  <pre><code>public string ReverseString(string sz)
  {
      string result = string.Empty;
      for(int i = sz.Length-1; i&gt;=0; i--)
      {
        result += sz[i]
      }
      return result;
  }
  </code></pre>
  
  <p>I couldn't spot it. I saw no problems whatsoever. 
  In hindsight I could have said the user should resize but it looks like C# doesn't have a resize (i am a C++ guy).</p>
  
  <p>I ended up writing things like use an iterator if its possible, [x] in containers could not be random access so it may be slow. and misc things. But I definitely said I never had to optimize C# code so my thinking may have not failed me on the interview.</p>
  
  <p>I wanted to know, what is the problem with this code, do you guys see it?</p>
  
  <p>-edit-</p>
  
  <p>I changed this into a wiki because there can be several right answers.
  Also i am so glad i explicitly said i never had to optimize a C# program and mentioned the misc other things. Oops. I always thought C# didnt have any performance problems with these type of things. oops.</p>