1.

Which of the following is the correct way to implement a write only property Length in a Sample class?

A. <pre><code class="csharp">class Sample { public int Length { set { Length = value; } } }</code></pre>
B. <pre><code class="csharp">class Sample { int len; public int Length { get { return len; } set { len = value; } } }</code></pre>
C. <pre><code class="csharp">class Sample { int len; public int Length { WriteOnly set { len = value; } } }</code></pre>
D. <pre><code class="csharp">class Sample { int len; public int Length { set { len = value; } } }</code></pre>
Answer» E.


Discussion

No Comment Found

Related MCQs