编程语言
首页 > 编程语言> > c#反射

c#反射

作者:互联网

原文链接:https://my.oschina.net/u/2296689/blog/545759
void DynamicallyInvokeMembers(Assembly myAssembly)
{
Type classType = myAssembly.GetType(“Reflected”);
PropertyInfo myProperty
= classType.GetProperty(“MyProperty”);
MethodInfo propGet = myProperty.GetGetMethod();
object reflectedObject
= Activator.CreateInstance(classType);
propGet.Invoke(reflectedObject, null);
MethodInfo myMethod
= classType.GetMethod(“MyInstanceMethod”);
myMethod.Invoke(reflectedObject, null);
}

转载于:https://my.oschina.net/u/2296689/blog/545759

标签:反射,Invoke,c#,classType,reflectedObject,MethodInfo,null,myProperty
来源: https://blog.csdn.net/chuoxieai9700/article/details/100904908