Properties of .NET declaration - Csharp.Net

Q.  Properties in .NET can be declare as

1. Static, Protected internal, Virtual
2. Public, internal, Protected internal
3. Only public
4. None

- Published on 31 Aug 15

a. 1, 2
b. 3
c. 1, 2, 3
d. 4

ANSWER: 1, 2
 
Properties are not variables. Properties are an extension of fields and are accessed using the same syntax. Properties cannot be passed as a ref or out parameter.A property is one or two code blocks, representing a get accessor or a set accessor or both. A property without a set accessor is considered read-only. A property without a get accessor is considered write - only.
Properties can be marked as public, private, protected, internal, protected internal, static, virtual.

Post your comment / Share knowledge


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)