You can create an internal property. This will make the property visible only within the same assembly. You can optionally use InternalsVisibleToAttribute to allow specific assemblies access to this property.
Another approach is to use interface to hide this property:
public interface ISomeClass { Manager m { get; } SpecialData data { get; set; } } public class SomeClass : ISomeClass { public Manager m { get; protected set; } SpecialData ISomeClass.data { get; set; }
Thus, data displayed only from a link to the interface.
So this does not work:
SomeClass c = new SomeClass(); c.data;
But it does:
ISomeClass c = new SomeClass(); c.data;
source share