How to access to the parent object in c#

后端 未结 7 840
难免孤独
难免孤独 2020-12-14 06:28

I have a \"meter\" class. One property of \"meter\" is another class called \"production\". I need to access to a property of meter class (power rating) from production clas

7条回答
  •  遥遥无期
    2020-12-14 06:57

    You could maybe add a method to your Production object called 'SetPowerRating(int)' which sets a property in Production, and call this in your Meter object before using the property in the Production object?

提交回复
热议问题