As far as I know, private
is the default everywhere in C# (meaning that if I don't write public
, protected
, internal
, etc. it will be private
by default). (Please correct me if I am wrong.)
So, what's the reason to write that keyword, or why does it even exist for members?
For example, when an event handler is auto-generated it looks like this:
private void RatTrap_MouseEnter(object sender, CheeseEventArgs e)
{
}
But why does it even write private if that's implied and default? Just so that novice developers (who don't know it's the C# default) know that it's private? Or is there a difference for the compiler?
Moreover, is there a case where writing "private" (alone) will change the accessibility of the member?
internal
by default however. – Peroxideprivate
is a pretty much redundant keyword. – Freethinker