Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There's a certain amount of misinformation here:</p> <blockquote> <p>"The default access modifier is not private but internal" </p> </blockquote> <p>Well, that depends on what you're talking about. For members of a type, it's private. For top-level types themselves, it's internal.</p> <blockquote> <p>"Private is only the default for <em>methods</em> on a type" </p> </blockquote> <p>No, it's the default for <em>all members</em> of a type - properties, events, fields, operators, constructors, methods, nested types and anything else I've forgotten.</p> <blockquote> <p>"Actually, if the class or struct is not declared with an access modifier it defaults to internal" </p> </blockquote> <p>Only for top-level types. For nested types, it's private.</p> <p>Other than for restricting property access for one part but not the other, the default is basically always "as restrictive as can be."</p> <p>Personally, I dither on the issue of whether to be explicit. The "pro" for using the default is that it highlights anywhere that you're making something more visible than the most restrictive level. The "pro" for explicitly specifying it is that it's more obvious to those who don't know the above rule, and it shows that you've thought about it a bit.</p> <p>Eric Lippert goes with the explicit form, and I'm starting to lean that way too.</p> <p>See <a href="http://csharpindepth.com/ViewNote.aspx?NoteID=54" rel="nofollow noreferrer">http://csharpindepth.com/ViewNote.aspx?NoteID=54</a> for a little bit more on this.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload