I want to do this:
interface IBase
{
string Property1 { get; }
}
interface IInherited : IBase
{
string Property1 { get; set; }
}
So th
Unfortunately not - properties cannot be extended as such. However, you can just hide the property by using new:
interface IInherited : IBase
{
// The new is actually unnecessary (you get warnings though), hiding is automatic
new string Property1 { get; set; }
}
Or, you can make your own getter and setter methods which can be overriden (good 'ol Java style):
interface IBase
{
string GetProperty1();
}
interface IInherited : IBase
{
void SetProperty1(string str);
}
Properties are actually converted to getter and setter methods by the compiler.