我有一个类型的对象和方法名称:获取MethodBase对象的最快方法是什么?
Type type;
string methodName;
,我需要的方法“方法名”一MethodBase对象,在堆栈中的某处。
这工作:
MethodBase nemo;
StackTrace st = new StackTrace(); // Behaves poorly...
for(int i =0; i< st.FrameCount; i++)
{
StackFrame sf = st.GetFrame(i);
if (sf.GetMethod().Name == methodName)
{
nemo = sf.GetMethod();
}
}
但我需要一个更快的方法...
您是否找到了更好的方法? :) – 2011-07-28 08:29:31
不,我没有... – seldary 2012-01-24 15:53:44