title: PowerShell And StringBuilder
body: <p>I am new in PowerShell but am familiar with .NET classes.</p>
  
  <p>I am using <code>System.Text.StringBuilder</code> in PowerShell script. The script is that</p>
  
  <pre><code>Function MyStringFunc([String]$line) {
      $r = New-Object -TypeName "System.Collections.Generic.List``1[[System.String]]";
      $sb = New-Object -TypeName "System.Text.StringBuilder";
  
      foreach ($c in $line) {
          $sb.Append($c);
          $r.Add($sb.ToString());
      }
  
      return $r;
  }
  
  $line1 = "123";
  $a = MyStringFunc $line1;
  $a
  </code></pre>
  
  <p>I expected the result is</p>
  
  <pre><code>1
  12
  123
  </code></pre>
  
  <p>However the result is</p>
  
  <pre><code>                  Capacity                MaxCapacity                    Length
                    --------                -----------                    ------
                          16                 2147483647                         3
  123
  </code></pre>
  
  <p>Did I do something wrong?</p>