【发布时间】:2010-02-21 04:19:08
【问题描述】:
假设我有以下课程:
class Cow {
public static bool TryParse(string s, out Cow cow) {
...
}
}
是否可以通过反射调用TryParse?我知道基础知识:
var type = typeof(Cow);
var tryParse = type.GetMethod("TryParse");
var toParse = "...";
var result = (bool)tryParse.Invoke(null, /* what are the args? */);
【问题讨论】:
-
这正是我要问的问题,甚至是方法名称:D
标签: c# .net reflection