Answer: No we can not create a class private in namespace. because namespace elements can not be private, protected or protected internal.
If you will create it, compiler will trow compile time error.
Example:
namespace TestNamespace{
private class testClass{
}
}
comiple time error:
"Elements defined in a namespace cannot be explicitly declared as private, protected, or protected internal"
Asked In: Many Interviews |
Alert Moderator