Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Properties should be very light weight that act and feel like fields. If you needs to access a database then you should use a method.</p> <p>See MSDN here: <a href="http://msdn.microsoft.com/en-us/library/bzwdh01d(VS.71).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/bzwdh01d(VS.71).aspx</a></p> <p><strong>Properties vs. Methods</strong></p> <p>Class library designers often must decide between implementing a class member as a property or a method. In general, methods represent actions and properties represent data. Use the following guidelines to help you choose between these options.</p> <p><strong>Use a property when</strong> </p> <ul> <li>The member is a logical data member. In the following member declarations, Name is a property because it is a logical member of the class.</li> </ul> <p><strong>Use a method when:</strong></p> <ul> <li>The operation is a conversion, such as Object.ToString.</li> <li>The operation is expensive enough that you want to communicate to the user that they should consider caching the result.</li> <li>Obtaining a property value using the get accessor would have an observable side effect.</li> <li>Calling the member twice in succession produces different results.</li> <li>The order of execution is important. Note that a type's properties should be able to be set and retrieved in any order.</li> <li>The member is static but returns a value that can be changed.</li> <li>The member returns an array. Properties that return arrays can be very misleading. Usually it is necessary to return a copy of the internal array so that the user cannot change internal state. This, coupled with the fact that a user can easily assume it is an indexed property, leads to inefficient code.</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.
 

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