How to get the value of non public member

前端 未结 1 2021
情深已故
情深已故 2021-01-24 21:34

How to get the value of non public member of the OPCGroup using OPCDA.NET in C#

private void DataChangeHandler(object sender, DataChangeEventArgs e)
{
   try
            


        
1条回答
  •  别那么骄傲
    2021-01-24 22:08

    You shouldn't try to use non-public members. If the author of the code has hidden it, you should assume that:

    • They don't want you to access it, at least not directly.
    • The implementation could change at any time, and your code should keep working.

    You can use reflection to access non-public members (assuming appropriate permissions at execution time) but I would highly discourage you from doing so if possible.

    0 讨论(0)
提交回复
热议问题