Hi
In C#, properties of interfaces are not implemented when using the option Implement Interface.
Given the following example :
interface MyInterface
{
string MyProperty { get; }
void MyMethod ();
}
class MyClass : MyInterface
{
}
Hover above the interface name MyInterface on the same line than MyClass. Pull down the refactoring menu. Click Implement Interface.
Note that only the method implementation is added. The property is not.
Which result in:
class MyClass : MyInterface
{
public void MyMethod ()
{
throw new Exception ( "The method or operation is not implemented." );
}
}
While we could expect:
class MyClass : MyInterface
{
public string MyProperty
{
get;
set;
}
public void MyMethod ()
{
throw new Exception ( "The method or operation is not implemented." );
}
}
Regards.