Delegates have the same restrictions as any type with respect to visibility. Therefore, you cannot have a private delegate at the top level .
namespace Test { private delegate void Impossible(); }
This creates a compiler error:
Elements defined in the namespace cannot be explicitly declared as private, protected, or protected internal
But, as a class, you can declare a delegate private when it is in another class .
namespace Test { class Sample {
The reason basically goes back to determining that private is in C #:
private | Access is limited to the containing type.
bobbymcr
source share