我需要使用Reflection.Emit生成一个实现以下接口的类.
public interface IObject
{
T Get<T>(string propertyName);
}
Run Code Online (Sandbox Code Playgroud)
有没有人有一个例子,我将如何发出以下作为一个简单的测试用例?
class GeneratedObject : IObject
{
public T Get<T>(string propertyName)
{
// this is the simplest possible implementation
return default(T);
}
}
Run Code Online (Sandbox Code Playgroud)