title: Exposing c# anonymous class objects to COM (JavaScript)
body: <p>Is there a class/API in .NET 4.5+ allowing to expose an instance of C# anonymous class as as late-bound object to COM? E.g. I want do this:</p>
  
  <pre><code>webBrowser.Document.InvokeScript("TestMethod", new object[] { 
      new { 
          helloProperty = "Hello!", 
          byeProperty = "Bye!"  
      }
  });
  </code></pre>
  
  <p>and use it in JavaScript:</p>
  
  <pre><code>function TestMethod(obj)
  {
      alert(obj.helloProperty + ", " + obj.byeProperty);
  }
  </code></pre>
  
  <p>It should not be a problem to create a helper class to wrap the anonymous object and expose its properties via <a href="http://msdn.microsoft.com/en-us/library/system.reflection.ireflect.aspx" rel="nofollow">IReflect</a>, but perhaps, something like this already exists? Just don't want to reinvent the wheel.</p>