代码之家  ›  专栏  ›  技术社区  ›  Branko

Delphi 2010 RTTI-如何获取索引属性列表?

  •  3
  • Branko  · 技术社区  · 14 年前

      Cont := TRttiContext.Create;
      for Prop in Cont.GetType(TStrings).GetDeclaredProperties do
        Memo1.Lines.Add(Prop.ToString);
      Cont.Free;
    

    我得到了tstring的所有属性的列表,除了索引属性(字符串,值,…)。 正如我在Get[Declared]中看到的,属性从来都不是索引属性。我怎样才能得到索引属性呢?

    1 回复  |  直到 14 年前
        1
  •  4
  •   Mason Wheeler    14 年前

    你不能。它们不包括在Delphi2010的RTTI中。