title: powershell function parameter types
body: <p>have the following function:</p>
  
  <pre><code>function appendToSB([System.Text.StringBuilder]$sb,
                      [string]$value){
      [void]$sb.append($value)
      $sb
  }
  
  $sb = new-object -typename system.text.stringbuilder
  $sb = appendToSb($sb, "1,")
  
  $sb.tostring() | out-host
  </code></pre>
  
  <p>i want to build string using StringBuilder using my function for that, but i receive the following error:</p>
  
  <blockquote>
    <p>appendToSB : Cannot process argument transformation on parameter 'sb'.
    Cannot convert the "System.Object[]" value of ty pe "System.Object[]"
    to type "System.Text.StringBuilder". At E:\powershell\test.ps1:8
    char:11
    + appendToSb([system.text.stringbuilder]$sb, "1,")
    +           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidData: (:) [appendToSB], ParameterBindingArgumentTransformationException
        + FullyQualifiedErrorId : ParameterArgumentTransformationError,appendToSB</p>
  </blockquote>
  
  <p>does anybody can explain how function/function parameter/return values works in powershell?</p>