通过反射访问字段_invocationList

时间:2015-08-11 11:25:34

标签: c# events visual-studio-2013 reflection delegates

是否可以使用反射从类私有字段_invocationList外部访问?

enter image description here

我试过

var bindingFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;

Type type = common.GetType();

var myEvent = type.GetEvent("OnTransformerTypeChanged");

var myfields = myEvent.GetType().GetFields(BindingFlags.NonPublic |BindingFlags.Instance);

var myfields = myEvent.GetType().GetField("_invocationList", BindingFlags.NonPublic | BindingFlags.Instance);

0 个答案:

没有答案