05/19/2022
Hello everyone,
I have created an OpcDataVariableNode, the type of this node is a class that contains a dynamic field and an integer field.
The dynamic field is an object of a dynamic type, defined at runtime.
When I try to read the node with a client, I can only read the int value, the dynamic value is always null.
How can I read the dynamic field?
Thanks.
05/19/2022
Randy Armstrong said
It is not clear what you are trying to do. Can you create a diagram?
I'm trying to read a dynamic object with the OPC client.
I have a class (called clsObj) with this attribute:
- public int n
- public dynamic myObject
The myObject attribute is istantiated at runtime because the type of this attribute is created dynamically.
I have implemented an OPC Server with a Node, the OpcDataVariableNode is of the type clsObj.
This is the code of the CreateNodes function:
var lgvNode = new OpcFolderNode("Lgv");
clsObj obj = new clsObj();
var node = new OpcDataVariableNode<clsObj>(lgvNode, "LGV1",obj);
yield return lgvNode;
At the server side I can see the value of the node LGV1 with the two attribute of the class clsObj .
After the Server creation, I've created an OPC Client and I read the value of the node with the ReadNode function.
When I read the value of the LGV1 node I see only the value of the attribute n, the value of the field myObject is always null.
I'm using the SDK with c# to implement all the project.
Thanks.
1 Guest(s)