InformationModel.MakeVariable(browseName, dataTypeId, arrayDimensions)
Creates a project variable derived from the
BaseDataVariableType
(base variable), which contains the data type indicated by the second argument and returns a corresponding IUAVariable
C# object. Using the third argument (optional), it is possible to create an array, specifying its type and size.static IUAVariable MakeVariable(QualifiedNamebrowseName, NodeIddataTypeId, uint[]arrayDimensions);
Arguments
- browseName(QualifiedName)
- TheBrowseNameof the new variable.
- dataTypeId(NodeId)
- The Data type contained in the new variable.TIP: The Data type is represented by a node inside theDataTypesclasses. For example,OpcUa.DataTypes.Boolean.
- arrayDimensions(uint[ ])
- Optional. The size of the Array.
Returns
- IUAVariable
- A C# object that corresponds to the project variable created.
Examples
The following example shows an API that creates an analog variable (
MyVar
) that contains floating data:var myVar = InformationModel.MakeVariable("MyVar", OpcUa.DataTypes.Float); Owner.Add(myVar);
The following example shows an API that creates a
MyArray
array with three cells:var arrayDimensions = new uint[1]; arrayDimensions[0] = 3 var myVar = InformationModel.MakeVariable("MyArray", OpcUa.DataTypes.Int32, arrayDimensions); Owner.Add(myVar);
Provide Feedback