我需要使用Reflection.Emit生成一個實現以下接口的類。使用Reflection.Emit創建實現接口的類
public interface IObject
{
T Get<T>(string propertyName);
}
有沒有人有我如何發出以下作爲簡單測試用例的例子?
class GeneratedObject : IObject
{
public T Get<T>(string propertyName)
{
// this is the simplest possible implementation
return default(T);
}
}
我重寫了這個問題;) – 2009-10-30 18:38:45