I've created an interface with some properties.
If the interface didn't exist all properties of the class object would be set to
{ get; private set; }
However, this isn't allowed when using an interface,so can this be achieved and if so how?
In interface you can define only getter
for your property
interface IFoo
{
string Name { get; }
}
However, in your class you can extend it to have a private setter
-
class Foo : IFoo
{
public string Name
{
get;
private set;
}
}