I have the following interface:
public interface IAgable {
int Age { get; internal set; }
}
I want the Age
property, to be read-only for external assemblies that reference this interface, but also I want the Age
property to be set on the interface's same assembly, hence the internal
modifier.
This, however, seems to throw a compilation error, as accessibility modifiers may not be used on accessors in an interface.
I want the property to be called from an interface, and I want to be able to set it at an internal level. At the same time, if referenced from an outside project, I want it to be readonly.
Is this possible?