title: C# variable length args, which is better and why: __arglist, params array or Dictionary<T,K>?
body: <p>I recently read the following overflow post:
  <a href="https://stackoverflow.com/questions/9033/hidden-features-of-c">Hidden Features of C#</a></p>
  
  <p>One of the features pointed out was the arglist. Why would one choose this or the alternatives as a means of using a variable length argument list to a method? Also, note that I would probably not use this kind of construct in my code unless a corner case warranted doing so. This is more of a question of semantics than whether it is even practical or prudent to even use variable length arguments. So does anyone know which is better and why?</p>
  
  <pre><code> [Test]
   public void CanHandleVariableLengthArgs()
   {
       TakeVariableLengthArgs(__arglist(new StringBuilder(), 12));
  
       object[] arr = { new StringBuilder() };
       TakeVariableLengthArgs2(arr);
  
       TakeVariableLengthArgs3(
           new Dictionary&lt;string, object&gt; 
           { { "key", new StringBuilder() } });
   }
  
   public void TakeVariableLengthArgs(__arglist)
   {
        var args = new ArgIterator(__arglist);
  
        var a = (StringBuilder)TypedReference.ToObject(args.GetNextArg());
        a.Append(1);
   }
  
   public void TakeVariableLengthArgs2(params object[] args)
   {
        var a = (StringBuilder)args[0];
        a.Append(1);
   }
  
   public void TakeVariableLengthArgs3(Dictionary&lt;string, object&gt; args)
   {
        var a = (StringBuilder)args["StringBuilder"];
        a.Append(1);
   }
  </code></pre>