I have an interface
public interface IIntf { string Foo { get; set; } }
and a class
class MyClass : IIntf
{
public string Foo { get; private set; }
}
. Now I get the compiler error
'MyClass' does not implement interface member 'IIntf.Foo.set'. 'MyClass.Foo.set' is not public.
So it seems that Foo.set
is its own entity somehow (and Foo.get
analogously). Can I do anything with them? If yes, what?
E.g. I tried implementing the missing setter property by using Foo.set
- it was even suggested by Visual Studio
but I did not find any syntax that works. When following the suggestion and trying to implement the Foo.set
method (without corresponding get
because I have that already), I get a different type of compiler error:
But since Visual Studio shows (and, at times, suggests while typing code) Foo.set
and Foo.get
, I assume that something can be done with them. Any ideas what? Maybe some nice way of redirecting methods to only the getter / only the setter? Or something else?