class MyClass
{
**private** delegate void MyDelegate(); //error: MyDelegate is less accessible than property Del
private MyDelegate del;
public MyDelegate Del
{
get { return this.del; }
set { this.del = value; }
}
}
Changing to public fixes, but I would like to know why in more detail.
MyDelegateis part of the signature of the public propertyDel.If something consumes the return value of
Del, it certainly needs the definition of the type being returned.In other words, if some other class has an instance of
MyClasslike this:would not be possible unless
MyDelegateis a type known to that class.