I’m reading Petzold’s free (.PDF) WP7 book, and he says that he always changes “EventArgs e” to “EventArgs args” in event handlers (which makes sense to me, as “e” sometimes conflicts with what I want to name the Exception object); but he also says he removes the accessibility modifiers that are automatically prepended sometimes.
I’m wondering why he does so, and:
1) Should I adopt the same practice
2) If that's a better way (Petzold is no wet-behind-the-ears greenhorn), why doesn't MS create these methods that way by default?
(I’m assuming this is a matter of removing the
privateaccess modifier from a method. If it’s removing (say)publicthen that’s a semantic change, and a different matter.)It’s definitely a matter of personal preference. I used to favour removing the access modifier when it was the default, but these days I prefer to be explicit.
Benefits of leaving it implicit:
Benefits of making it explicit:
If you want an “appeal to authority” you may be interested to know that Miguel de Icaza favours (vehemently) the former approach, and Eric Lippert favours the latter.