7
我有一个已发布道具的类,我将其序列化为XML。由于XML大小至关重要,因此我使用属性给属性赋予较短的名称(即,我无法定义名为'Class'的属性)。 序列化实现方式如下:获取特定属性的属性值
lPropCount := GetPropList(PTypeInfo(Obj.ClassInfo), lPropList);
for i := 0 to lPropCount - 1 do begin
lPropInfo := lPropList^[i];
lPropName := string(lPropInfo^.Name);
if IsPublishedProp(Obj, lPropName) then begin
ItemNode := RootNode.AddChild(lPropName);
ItemNode.NodeValue := VarToStr(GetPropValue(Obj, lPropName, False));
end;
end;
我需要像条件:如果标有MyAttr财产,得到 “MyAttr.Name”,而不是 “lPropInfo ^请将.Name” 的。