首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

DelphiXE2 获取不到动态数组的RTTI信息,莫非是Delphi的Bug?

2013-01-01 
DelphiXE2 获取不到动态数组的RTTI信息,难道是Delphi的Bug??本帖最后由 fghydx 于 2012-11-01 16:29:23 编

DelphiXE2 获取不到动态数组的RTTI信息,难道是Delphi的Bug??
本帖最后由 fghydx 于 2012-11-01 16:29:23 编辑 type
   TarrRec=TArray<TARecort>;

   TTestClass=class(TInterfacedObject)
   public
     function TTest_Proxy.GetArr: TarrRec;   // 这样写不能获得RTTI呢,
     function TTest_Proxy.GetArr1: TArray<TARecort>;  // 这样写就行,有没有人碰到过?
   end;

T:=TRttiContext.Create.GetType(TTestClass);
method:=t.GetMethod('GetArr');

if Method.MethodKind=mkFunction then  取不到
[解决办法]
 TarrRec=TArray<TtestRecort>;好奇葩的写法,用D7的表示没见过
[解决办法]
不用tarray,直接定义为 Array of TtestRecort

热点排行