MAttribute = class(TCustomAttribute)
private
FName: string;
public
constructor Create(AName: string);
end;
TMyClass = class
private
FProp2: Integer;
FProp1: string;
procedure SetProp1(const Value: string);
procedure SetProp2(const Value: Integer);
public
procedure Methd1(const A,B: string);
function Func1: Boolean;
published
[M('Prop1')]
property Prop1: string read FProp1 write SetProp1;
[M('Prop2')]
property Prop2: Integer read FProp2 write SetProp2;
end; procedure TForm1.btn1Click(Sender: TObject);
var
c: TRttiContext;
t: TRttiType;
ms: TArray<TRttiMethod>;
ps: TArray<TRttiProperty>;
fs: TArray<TRttiField>;
ats: TArray<TCustomAttribute>;
a : TCustomAttribute;
m: TRttiMethod;
p: TRttiProperty;
f: TRttiField;
begin
c := TRttiContext.Create;
t := c.GetType(TMyClass);
ms := t.GetMethods;
ps := t.GetProperties;
fs := t.GetFields;
ats := t.GetAttributes; for p in ps do
begin
for a in p.GetAttributes do
begin
if a is MAttribute then
begin
mmo1.Lines.Add(p.Name + ':' + MAttribute(a).FName);
end;
end;
end; mmo1.Lines.Add('-------------Methods-----------');
for m in ms do
mmo1.Lines.Add(m.Name);
mmo1.Lines.Add('------------Properties---------');
for p in ps do
mmo1.Lines.Add(p.Name);
mmo1.Lines.Add('--------------Fields-----------');
for f in fs do
mmo1.Lines.Add(f.Name); end;

System.Rtti.TRttiObject.GetAttributes 简例的更多相关文章

  1. linux下C语言socket网络编程简例

    原创文章,转载请注明转载字样和出处,谢谢! 这里给出在linux下的简单socket网络编程的实例,使用tcp协议进行通信,服务端进行监听,在收到client的连接后,发送数据给client:clie ...

  2. system函数的应用一例

    system函数的应用一例

  3. 5.3linux下C语言socket网络编程简例

    原创文章,转载请注明转载字样和出处,谢谢! 这里给出在Linux下的简单socket网络编程的实例,使用tcp协议进行通信,服务端进行监听,在收到客户端的连接后,发送数据给客户端:客户端在接受到数据后 ...

  4. List元素排序简例

    前言:这种处理方式,在程序中偶尔会用的到,栗子很简单,关键是加强一下记忆,以及以备后用 1:实现Comparable接口的方式 1-1:没有使用泛型,重写compareTo()方法时需要判断类型及转换 ...

  5. java_jdbc_spring框架查询操作简例

    1.添加commons-dbcp-1.4,commons-logging,commons-pool-1.2//线程池,commons.collections-3.2.1.jar,spring.jar ...

  6. web Service试用简例

    1.打开文件,选择新建Asp.Net web服务. 2.出现新建页面如下. using System; using System.Collections.Generic; using System.L ...

  7. Dapper试用简例

    1.选择3.5以上框架在新建项目中引用Dapper.dll. 2.在后台写代码,代码写出来后感觉以前学的都白学了. 3. using Dapper; using System; using Syste ...

  8. jvm内存增长问题排查简例

    jvm内存增长问题排查 排查个jvm 内存占用持续增加的问题,纪录一下,引以为戒. 运维发现应用jvm内存占用在发布后回落,然后持续增高,,dump后分析一下: 占内存的大部分是这种名字相似的bean ...

  9. urllib 和urllib2 模块使用简例

    一.最简单的使用 import urllib,urllib2 response = urllib2.urlopen("https://www.baidu.com") print r ...

随机推荐

  1. TCP protocol

    he characteristics of TCP protocol TCP (which means Transmission Control Protocol) is one of the mai ...

  2. Java连接MySQL数据库及简单操作代码

    1.Java连接MySQL数据库 Java连接MySql需要下载JDBC驱动MySQL-connector-java-5.0.5.zip(举例,现有新版本).然后将其解压缩到任一目录.我是解压到D盘, ...

  3. php扩展函数调用扩展中的标准函数

    这几天在写php的扩展函数,在网上学习步骤什么的都有,一般问题也都能查到,所以就不再此啰嗦,写这篇博客的原因是因为遇到的一个问题,百度谷歌都没找到,对于初学者,这个或许有用,对于过来人,我想他们肯定也 ...

  4. HDU3709 Balanced Number (数位dp)

     Balanced Number Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Descript ...

  5. asp.net 使用JQuery 调用Ashx 后面直接写方法名,通过反射找到对应的方法

    using System.Reflection; public class Industry_Manager : IHttpHandler { HttpRequest gRequest = null; ...

  6. 连接Excel时出现未指定的错误

    使用  strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filepath + ";Extended ...

  7. 图片鼠标滑过图片半透明(jquery特效)

    在做瑞祥之旅的过程,有一个部分是材料体系,材料体系下面.预览效果

  8. ANDROID开发之SQLite详解

    本文转自:http://www.cnblogs.com/Excellent/archive/2011/11/19/2254888.html

  9. hisi平台mii网络模式和rmii网络模式的uboot制作

    MII网络uboot编译说明 一:编译生成默认的uboot1. 进入到uboot目录a. cd /home/satan/Hi3518_SDK_V1.0.7.0/osdrv/uboot2. 新建临时文件 ...

  10. MySQL5.6 replication architecture --原图来自姜承尧