How can I开发者_Go百科 instantiate an anonymous object while passing the propertynames and values as string?
new With { .SomeProperty = "Value" }
new With { ".SomeProperty" = "Value" } //something like this? :)
There's no easy way to do this in VB.net. The JIT compiler doesn't keep the method names intact in the MSIL code, only in the metadata.
You can do this using the System.Reflection namespace and searching the metadata for a method by the name passed. It's fairly expensive, though.
精彩评论