public class TestClass
{
private int a = ;//私有一律获取不到
public int b
{
get { return ; }
set { value = ; }
}
public int c = ;
} public static void TestMethod()
{
TestClass test = new TestClass();
PropertyInfo[] pro = test.GetType().GetProperties();
FieldInfo[] fil = test.GetType().GetFields();
MemberInfo[] men = test.GetType().GetMembers(); foreach (var item in pro)//仅能获取到b属性(输出b=2)
{
Console.WriteLine("PropertyInfo: " + item.Name +"=" + item.GetValue(test, null));
}
foreach (FieldInfo item in fil)//仅能获取到c字段(输出c=2)
{
Console.WriteLine("FieldInfo: " + item.Name + "=" + item.GetValue(test));
}
foreach (MemberInfo item in fil)//仅能获取到c字段(输出c)
{
Console.WriteLine("MemberInfo: "+ item.Name );
}
}

问题:

[多选] 哪个对象的类型来源于MemberInfo类?()

A . FieldInfo class
B . MethodInfo class
C . Assembly class
D . Type cla

参考答案: A, B, D

参考

[整理]C#反射(Reflection)详解

最新文章

  1. 转-Apache的Order Allow,Deny 详解
  2. wordpress(三)wordpress手动更新
  3. Visual Studio 2013 Nuget控制台无法找到程序包
  4. JVM 内存
  5. HDU 2222 Keywords Search(AC自动机入门)
  6. NSKeyedArchiver 类 格式
  7. Git的优势
  8. angularjs2 学习笔记(二) 组件
  9. vim插件配置(一)
  10. Chapter 1 Securing Your Server and Network(1):选择SQL Server运行账号
  11. Linux -atime、mtime、ctime
  12. H3C数据中心虚拟化解决方案技术白皮书
  13. 重写,string创建内存问题
  14. Linux下redis的安装及配置
  15. MySql数据库连接池专题
  16. Activity启动模式 Tasks和Back Stack
  17. mysql 通过慢查询日志查写得慢的sql语句
  18. 【转】Python中的eval()、exec()及其相关函数
  19. cf相关命令
  20. jquery ajax 设置请求头header 参数

热门文章

  1. linux环境查看版本信息
  2. 运维nslookup语法
  3. linux复习2:Fedora17系统的安装和删除
  4. bat批处理的注释语句
  5. 搭建CocoaPods远程私有库
  6. MySQL数据库数据类型以及INT(M)的含义
  7. JVM内存分配和垃圾回收以及性能调优
  8. Java函数优雅之道
  9. 008-zabbix监控nginx
  10. java高并发核心要点|系列1|开篇