Exposing c# anonymous class objects to COM (JavaScript)
Is there a class/API in .NET 4.5+ allowing to expose an instance of C#
anonymous class as as late-bound oject to COM? E.g. I want do this:
webBrowser.Document.InvokeScript("TestMethod", new object[] {
new {
helloProperty = "Hello!",
byeProperty = "Bye!"
}
});
and use it in JavaScript:
function TestMethod(obj)
{
alert(obj.helloProperty + ", " + obj.byeProperty);
}
It should not be a problem to create a helper class to wrap the anonymous
object and expose its properties via IReflect, but perhaps, something like
this already exists? Just don't want to reinvent the wheel.
No comments:
Post a Comment