参见英文答案 >
Programmatic equivalent of default(Type)12个
什么是反射相当于:
什么是反射相当于:
default(object); //null@H_404_5@当我在运行时之前没有类型时,例如
public void Method(Type type) { var instance = type.CreateDefault(); //no such method exists,but I expect there is a way of doing this? }