Possibly the designers of C# wanted and liked "religious" fights on whether or not to include refundant access modifiers?
(In cases where only one access level is possible, access modifiers are usually disallowed: For example, a member of an interface or an enum is always public
but it's not allowed to write that. A partial
method is always private
but you can't write that. Since a static
constructor can't be called explicitly, there's no meaningful access level. An explicit interface implementation is not really visible for direct call, but is freely accessible through the interface type (if the interface type is visible from the outside). Namespaces can have no access modifier.)
The opposite rule from what you suggest, would of course be a rule saying that it is not allowed to specify a modifier that doesn't change anything. That would mean that a direct member of a namespace (including the implicit "global namespace") could not be explicitly declared internal
, and that a member of a class or struct (including nested types) could not have the keyword private
. Some people use this convention.
Note that getters and setters of properties and indexers cannot specify a redundant access level. The only thing allowed here is for just one of the two accessors (there must be two in that case) to specify a more strict access.