Suppose I have a structure in my class:
class MyClass
{
public struct MyStruct_t
{
public int someValue1;
public int someValue2;
}
public MyStruct_t MyStruct;
public InitStructure()
{
MyStruct.someValue1 = 1;
MyStruct.someValue2 = 1;
}
}
I want this structure will be read only from outside only and read/write inside the class. Like this:
MyClass cls = new MyClass();
cls.InitStructure();
int value = cls.MyStruct.someValue1;
cls.MyStruct.someValue2 = value; // here must be an error
I guess it should be something like friend
keyword in C++. How can I do that?