Use the following method to get multiple properties from multiple objects. This is useful if all the objects have the same type, or have the same target properties.
Library method name |
ReadPropertyMultiple
|
---|---|
Description | Get multiple properties from multiple objects. |
Method signature |
IEnumerable<VariantMultiple> ReadPropertyMultiple(IEnumerable<Guid> ids,IEnumerable<string> attributeNames);
|
Method input parameters |
|
Return value | A collection of VariantMultiple objects. |
The following .NET C# code is an example of a successful multiple property read:
List<Guid> ids = new List<Guid> { id1, id2 };
List<string> attributes = new List<string> { "name", "description" };
IEnumerable<VariantMultiple> results = client.ReadPropertyMultiple(ids, attributes);
// Get the values for first object
var object1Values = results.ElementAt(0)
// Get name from first object
var name = object1Values.ElementAt(0).StringValue;
// Get description from second object
var description = object1Values.ElementAt(1).StringValue;
Console.WriteLine(name);
Console.WriteLine(description);
/*
Outputs:
ZN-T
Zone Temperature
*/