Getting set accessor for property in abstract class, not possible?
- by Lars Udengaard
Given the class':
public abstract class AbstractEntity
{
public virtual Guid Id { get; private set; }
}
public class Entity
{
public virtual Guid Id { get; private set; }
}
And a PropertyInfo for the property 'Id'.
When calling the method:
PropertyInfo.GetAccessors()
It returns both the get-method and the set-method when the class is not abstract (Entity),
but only the get-method when the class is abstract (AbstractEntity).
Why is this? And is there another way to get the set-method from a property with a private set?