C# Programming - Properties - Discussion

Discussion Forum : Properties - General Questions (Q.No. 7)
7.
Which of the following is the correct way to implement a write only property Length in a Sample class?
class Sample
{
    public int Length
    {
        set
        {
            Length = value;
        } 
    } 
}
class Sample
{
    int len;
    public int Length
    {
        get
        {
            return len;
        }
        set
        {
            len = value;
        } 
    } 
}
class Sample
{
    int len;
    public int Length
    {
        WriteOnly set
        {
            len = value;
        } 
    } 
}
class Sample
{
    int len;
    public int Length
    {
        set
        {
            len = value;
        }
    } 
}
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.