I have a class, which contains a simple data model class with properties. Only the outer class should be allowed to call the setters of the properties of the inner class. How can I achieve that?
public class Outer {
public class Inner {
public string Data { get; whatilookfor set; }
}
public Outer() {
Inner test = new Inner() { Data = "Test" }; // This should work
}
}
public class SomeOther {
public SomeOther() {
Inner otherTest = new Inner() { Data = "Other Test" }; // This should fail
}
}