To read a property of an object, you must know the GUID of the target object. When you request a property from an object, you receive a variant object. A variant can represent many data types and consequently you might get properties in addition to the one you want. If the server cannot find the target object or property on the object, this method raises an exception.
Library method name |
ReadProperty
|
---|---|
Description | Read a property of an object. |
Method signature |
Variant ReadProperty(Guid id, string attributeName);
|
Method input parameters |
|
Return value | Variant object |
The following .NET C# code is an example of a successful property read:
Variant property = client.ReadProperty(objectId, "presentValue");
//Since we know the present value is numeric we can extract it from the variant:
var rawValue = property.NumericValue;
Console.WriteLine(rawValue);
/*
Outputs:
72.0
/*