I'm starting to learn C# and I'm stuck with a little problem. I don't know if there's a solution for what I want to do or I have to do it in a different way. Anyway, I'm trying to modify the value of a class variable returned by a method. The code below shows more or less what I want to do.
public Class AClass
{
private SomeClass A;
private SomeClass B;
private SomeClass C;
private SomeClass D;
private enum SomeEnum {A, B, C, D};
private void SomeMethod(SomeEnum theEnum, SomeClass theNewValue){
SomeClass oldValue = GetSomeClass(theEnum);
oldValue = theNewValue;
}
private SomeClass GetSomeClass (SomeEnum theEnum){
switch(theEnum){
case A:
return A;
case B:
return B;
case C:
return C;
case D:
return D;
}
return null;
}
}
Do you guys have any solution or alternative?
privatecannot be addressed from the "outside" of this class, e.g. if you create an instance of this class, you can basically do nothing at all with that instance, because there are no public methods or properties to access!