PropertyItem(Index: Integer): IForeProperty;
Index. Property index. Index value is specified in the range [0, PropertiesCount-1].
The PropertyItem method returns information about the property with the specified index.
Executing the example requires that the repository contains an assembly with the ASSM_TEST identifier. The CCalculate class is implemented in the assembly, the class has some properties.
Add links to the Fore, Metabase, and Xml system assemblies.
Sub UserProc;
Var
ForeService: IForeServices;
Runtime: IForeRuntime;
Assm: IForeAssembly;
FClass: IForeClass;
FProp: IForeProperty;
i, j: Integer;
Begin
ForeService := MetabaseClass.Active As IForeServices;
Runtime := ForeService.GetRuntime;
// Load assembly
Assm := Runtime.BindToAssembly("ASSM_TEST");
// Get information about class properties
FClass := Assm.BindToClass("CCalculate");
j := FClass.PropertiesCount - 1;
For i := 0 To j Do
FProp := FClass.PropertyItem(i);
Debug.WriteLine("Property: " + FProp.Name);
Debug.Indent;
Debug.WriteLine("Default value: " + FProp.IsDefault.ToString);
Debug.WriteLine("Static: " + FProp.IsStatic.ToString);
Debug.WriteLine("Method that implements Get part: " + FProp.NameOfGetMethod);
Debug.WriteLineIf(FProp.NameOfSetMethod <> "", "Method that implements Set part: " + FProp.NameOfSetMethod);
If FProp.XMLDocumentation <> Null Then
Debug.WriteLine("Comments:");
Debug.Indent;
PrintXml(FProp.XMLDocumentation);
Debug.Unindent;
End If;
Debug.Unindent;
End For;
End Sub UserProc;
Sub PrintXml(_doc: IXmlDomDocument);
Var
_nodes: IXmlDomNodeList;
_node: IXmlDomNode;
_elem: IXmlDomElement;
Begin
_elem := _doc.documentElement;
Debug.WriteLine("Root node: " + _elem.nodeName);
_nodes := _elem.childNodes;
Debug.WriteLine("Root child count: " + _nodes.length.ToString);
Debug.WriteLine("Nodes: ");
Debug.Indent;
_node := _nodes.nextNode;
While _node <> Null Do
Debug.WriteLine("Name: " + _node.nodeName + ", Text: " + _node.text);
_node := _nodes.nextNode;
End While;
Debug.Unindent;
End Sub PrintXml;
On executing the example, the repository assembly with the specified identifier will be loaded to the execution environment. The development environment console will display information about properties implemented in the CCalculate class.
See also: