C# - Making fields/properties read only conditionally
- by Alistair77
I have three classes; Classes A and B both reference class C.
How can I make it so members of class C can be modified when referenced from class A but not modified when referenced 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;
Making classB.classC read-only still allows properties of classC to be altered.
I'm sure this is basic stuff but can't find a simple answer.
Thanks,
A