I have three classes; Classes A and B both reference class C
How can I make sure that members of class C can be changed with a link from class A , but not changed with a link from class B ?
IE, the following should be possible:
classA myClassA = new classA(); myClassA.myClassC.IssueNumber = 3;
But this should not be possible;
classB myClassB = new classB(); myClassB.myClassC.IssueNumber = 3;
Creating classB.classC only classB.classC allows you to change the properties of classC .
I am sure that this is the main material, but cannot find a simple answer.
Thanks A
immutability c # readonly
Alistair77
source share