The aforesaid says that the property should not be only "Set" (code analysis rule CA1044), and it should also be "Get". What should I do if I need to set a value for a variable from another class?
The change will continue, so I can not pass it through the constructor.
Create a function for this as shown below?
class A { public void SetValue() { b = new B(); b.SetTest(10); } } class B { int test; public void SetTest(int value) { test = value; } }
What are the other alternatives?
source share