MCQs > IT & Programming > C# > Why won't this code compile class A { private int i; public int P { get { return i; } set { i = value; } } public int get_P() { return i; } public void set_P(int i) { this.i = i; } }

C# MCQs

Why won't this code compile class A { private int i; public int P { get { return i; } set { i = value; } } public int get_P() { return i; } public void set_P(int i) { this.i = i; } }

Answer

Correct Answer: In C# and VB.NET properties are implemented as methods named get_XXX and set_XXX​​, so we cannot have the same methods with same parameter types twice. ​​

Explanation:

Note: This Question is unanswered, help us to find answer for this one

C# Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

C# Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it