`
yanshaozhi
  • 浏览: 102864 次
  • 性别: Icon_minigender_1
  • 来自: 东营
社区版块
存档分类
最新评论

c#反射

    博客分类:
  • c#
阅读更多
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);
}
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics