Curioustab
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Home
»
C# Programming
»
Properties
Which of the following is the correct way to implement a read only property Length in a Sample class?
class Sample { int len; public int Length { get { return len; } } }
class Sample { public int Length { get { return Length; } } }
class Sample { int len; public int Length { get { return len; } set { len = value; } } }
class Sample { int len; public int Length { Readonly get { return len; } } }
Show Answer
Correct Answer:
class Sample { int len; public int Length { get { return len; } } }
Next Question→
Discussion & Comments
No comments yet. Be the first to comment!
Name:
Comment:
Post Comment