Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><code>public</code> by itself means this is an instance-based member that is accessible to external callers (those with access to the type itself).</p> <p><code>static</code> by itself means the member is not instance-based: you can call it without needing any particular instance (or even any instance at all); without an accessibility qualifier, non-public is assumed - so the member will not be accessible to external callers.</p> <p><code>public static</code> is a <code>static</code> method that <em>is</em> accessible to external callers.</p> <p>Memory usage is identical in both cases: any variables declared in the method are scoped to the method-call itself (as an implementation detail: via the stack; also: I'm assuming no "captured variables", and no <code>async</code> or <code>yield</code> usage),</p> <p>Nothing in this is specific to ASP.NET / MVC. However, "action" methods on controllers are, IIRC, expected to be public / instance, so <em>with</em> the <code>public</code> modifier, and <em>without</em> the <code>static</code> modifier.</p> <p>Basically:</p> <p>Accessibility:</p> <ul> <li>none specified: defaults to "private" (or "internal" for outer-classes)</li> <li>"private": only available to code inside that type</li> <li>"protected": available to code inside that type or sub-types</li> <li>"internal": available to code in the same assembly</li> <li>"protected internal": either "protected" <strong>or</strong> (union) "internal"</li> <li>"public": available to all callers with access to the type</li> </ul> <p>Static / etc:</p> <ul> <li>none specified: instance-based; an instance is required, and code has automatic access to instance-members (via <code>this.</code>) and <code>static</code> members</li> <li>"static": no instance is required; code has automatic access to <code>static</code> members only</li> </ul>
    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. 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