using System;
using System.Reflection; class Module1
{
public static void Main()
{
// This variable holds the amount of indenting that
// should be used when displaying each line of information.
Int32 indent = ;
// Display information about the EXE assembly.
Assembly a = typeof(Module1).Assembly;
Display(indent, "Assembly identity={0}", a.FullName);
Display(indent+, "Codebase={0}", a.CodeBase); // Display the set of assemblies our assemblies reference. Display(indent, "Referenced assemblies:");
foreach (AssemblyName an in a.GetReferencedAssemblies() )
{
Display(indent + , "Name={0}, Version={1}, Culture={2}, PublicKey token={3}", an.Name, an.Version, an.CultureInfo.Name, (BitConverter.ToString (an.GetPublicKeyToken())));
}
Display(indent, ""); // Display information about each assembly loading into this AppDomain.
foreach (Assembly b in AppDomain.CurrentDomain.GetAssemblies())
{
Display(indent, "Assembly: {0}", b); // Display information about each module of this assembly.
foreach ( Module m in b.GetModules(true) )
{
Display(indent+, "Module: {0}", m.Name);
} // Display information about each type exported from this assembly. indent += ;
foreach ( Type t in b.GetExportedTypes() )
{
Display(, "");
Display(indent, "Type: {0}", t); // For each type, show its members & their custom attributes. indent += ;
foreach (MemberInfo mi in t.GetMembers() )
{
Display(indent, "Member: {0}", mi.Name);
DisplayAttributes(indent, mi); // If the member is a method, display information about its parameters. if (mi.MemberType==MemberTypes.Method)
{
foreach ( ParameterInfo pi in ((MethodInfo) mi).GetParameters() )
{
Display(indent+, "Parameter: Type={0}, Name={1}", pi.ParameterType, pi.Name);
}
} // If the member is a property, display information about the property's accessor methods.
if (mi.MemberType==MemberTypes.Property)
{
              Display(indent, "PropertyName:{0}", mi.Name);
foreach ( MethodInfo am in ((PropertyInfo) mi).GetAccessors() )
{
Display(indent+, "Accessor method: {0}", am);
}
}
}
indent -= ;
}
indent -= ;
}
} // Displays the custom attributes applied to the specified member.
public static void DisplayAttributes(Int32 indent, MemberInfo mi)
{
// Get the set of custom attributes; if none exist, just return.
object[] attrs = mi.GetCustomAttributes(false);
if (attrs.Length==) {return;} // Display the custom attributes applied to this member.
Display(indent+, "Attributes:");
foreach ( object o in attrs )
{
Display(indent+, "{0}", o.ToString());
}
} // Display a formatted string indented by the specified amount.
public static void Display(Int32 indent, string format, params object[] param) {
Console.Write(new string(' ', indent*));
Console.WriteLine(format, param);
}
}

原文地址:https://docs.microsoft.com/zh-cn/dotnet/api/system.reflection.propertyinfo?redirectedfrom=MSDN&view=netframework-4.7.2

C# PropertyInfo(官网)的更多相关文章

  1. [干货]Chloe官网及基于NFine的后台源码毫无保留开放

    扯淡 经过不少日夜的赶工,Chloe 的官网于上周正式上线.上篇博客中LZ说过要将官网以及后台源码都会开放出来,为了尽快兑现我说过的话,趁周末,我稍微整理了一下项目的源码,就今儿毫无保留的开放给大家, ...

  2. 千呼万唤始出来,微软Power BI简体中文版官网终于上线了,中文文档也全了。。

    前几个月时间,研究微软Power BI技术,由于没有任何文档和资料,只能在英文官网瞎折腾,同时也发布了英文文档的相关文章:系列文章,刚好上周把文章发布完,结果简体中文版上线了.哈哈,心里有苦啊,早知道 ...

  3. Yeoman 官网教学案例:使用 Yeoman 构建 WebApp

    STEP 1:设置开发环境 与yeoman的所有交互都是通过命令行.Mac系统使用terminal.app,Linux系统使用shell,windows系统可以使用cmder/PowerShell/c ...

  4. 一键生成APP官网

    只需要输入苹果下载地址,安卓市场下载地址,或者内测下载地址,就能一键生成APP的官网,方便在网上推广. 好推APP官网 www.hotapp.cn/app

  5. RavenDB官网文档翻译系列第一

    本系列文章主要翻译自RavenDB官方文档,有些地方做了删减,有些内容整合在一起.欢迎有需要的朋友阅读.毕竟还是中文读起来更亲切吗.下面进入正题. 起航 获取RavenDB RavenDB可以通过Nu ...

  6. FineUI(开源版)v4.2.2发布(8年125个版本,官网示例突破300个)!

    开源版是 FineUI 的基石,从 2008 年至今已经持续发布了 120 多个版本,拥有会员 15,000 多位,捐赠会员达到 1,200 多位.   FineUI(开源版)v4.2.2 是 8 年 ...

  7. React.js 官网入门教程 分离文件 操作无法正常显示HelloWord

    对着React官网的教程练习操作,在做到分离文件练习时,按照官网步骤来却怎么也无法正常显示HelloWord. 经测试,html文件中内容改为: <!DOCTYPE html><ht ...

  8. 学记:spring boot使用官网推荐以外的其他数据源druid

    虽然spring boot提供了4种数据源的配置,但是如果要使用其他的数据源怎么办?例如,有人就是喜欢druid可以监控的强大功能,有些人项目的需要使用c3p0,那么,我们就没办法了吗?我们就要编程式 ...

  9. maven向本地仓库导入jar包(处理官网没有的jar包)

    对于官网没有的jar包,maven向本地仓库导入jar包用如下命令 mvn install:install-file -DgroupId=包名 -DartifactId=项目名 -Dversion=版 ...

  10. Unity 官网教程 -- Multiplayer Networking

    教程网址:https://unity3d.com/cn/learn/tutorials/topics/multiplayer-networking/introduction-simple-multip ...

随机推荐

  1. XP 系统如何安装.NET Framework4.0

    1 运行CMD,然后输入命令net stop WuAuServ   2 打开C盘的Windows目录,然后找到SoftwareDistribution文件夹改名为SDold.   3 在CMD窗口中输 ...

  2. InnoDB: Error: io_setup() failed with EAGAIN after 5 attempts

    在一台server中以各数据库的备份文件为数据文件启动多个MySQL实例供SQL Review使用. 之前执行一直没有问题(最多的时候有23个MySQL实例同一时候执行).后来新配置了一台server ...

  3. Cleave js 使用

    1111111111111111 xxxxxx Cleave.js 键入时格式化< input />内容   信用卡号码格式 明确   美国运通:从34/37开始 34   签证:从4开始 ...

  4. 图像处理之基础---opencv 开发的环境搭建

    vs2010 opencv2.4.8 下载: vs2010 http://opencv.org/ 步骤: http://my.phirobot.com/blog/2014-02-opencv_conf ...

  5. JAVA 并发编程-返回运行结果(Callable和Future)(九)

    启动一个线程不论使用Thread或者Runnable的时候.都是没有返回结果的. 也就是说Thread和Runnable的run()方法必须没有返回值. public void run(){} 解决方 ...

  6. 网络驱动移植之简述CS8900A网络芯片的基本原理

    CS8900A数据手册:http://www.cirrus.com/cn/products/cs8900a.html 1.概述 CS8900A是CIRRUS LOGIC公司生产的低功耗.性能优越的16 ...

  7. Ubuntu18开启redis服务自启动

    设置redis服务开机自启动. 1.创建配置文件夹 sudo mkdir /etc/redis sudo cp /usr/local/redis/redis.conf /etc/redis sudo ...

  8. I.MX6 各模块 clock 查询

    /********************************************************************* * I.MX6 各模块 clock 查询 * 说明: * ...

  9. hdu5410(完全背包变形)

    这是道完全背包,关键点在于如何处理每种物品,第一次放时,价值为A+B,以后放时,价值为A. 所以有三种决策,对于第i种物品,要么不放,要么是作为第一个放,要么是第二个以后放. 作为第一个放时,需要用到 ...

  10. STM32:获取复位源,软件复位

    RCC CSR寄存器会存储复位标示,可通过它来知道复位原因,来源: if(RCC_GetFlagStatus(RCC_FLAG_PINRST)) printf("PINRST\r\n&quo ...