我有以下類,從中我想從成員獲得一些名字,如姓名使用TRttiContext屬性的名稱;
TInterface = interface(IXMLNode)
function Get_One: Boolean;
function Get_Two: Boolean;
function Get_Three: Boolean;
procedure Set_One(Value: Boolean);
procedure Set_Two(Value: Boolean);
procedure Set_Three(Value: Boolean);
property One: Boolean read Get_One write Set_One;
property Two: Boolean read Get_Two write Set_Two;
property Three: Boolean read Get_Three write Set_Three;
end;
TTesting = class(TXMLNode, TInterface)
protected
function Get_One: Boolean;
function Get_Two: Boolean;
function Get_Three: Boolean;
procedure Set_One(Value: Boolean);
procedure Set_Two(Value: Boolean);
procedure Set_Three(Value: Boolean);
end;
讓我使用了一個TRttiContext
下面的方法名稱當運行它時,我總是有一個名爲RefCount的項目。
我不應該得到'One''Two''Three'的值嗎?
順便說一句,用'I'前綴而不是'T'命名接口是正常的。 T是用於類和記錄。 –
還有: http:// stackoverflow。com/questions/8679735/how-do-i-enumerate-all-properties-in-an-object-and-obtain-their-values –