为了动态地创建委托,技术从Delegate.CreateDelegate、Expresion、DynamicMethod等等都不一样。所有这些技术都要求您知道委托的类型。original delegate, with new 1st arg for @this
var openDelegate = dm.CreateDelegate(
我正在寻找更通用/“标准”的方法来实例化来自一组配对的字符串、对象中的某种类型T的对象。对我来说,看起来应该有一些众所周知的方法来做这件事,但我找不到它,所以我想出了这段代码。有没有人知道更好的?public class test public int field1; public bool field3; public IDictionary<string,object> field5 { get; set; }