How is a property designated as read-only?
Answer Posted / deep
In VB.NET:
Private mPropertyName as DataType
Public ReadOnly Property PropertyName() As DataType
Get Return mPropertyName
End Get
End Property
In C#
Private DataType mPropertyName;
public returntype PropertyName
{
get{
//property implementation goes here
return mPropertyName;
}
// Do not write the set implementation
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is clr in .net?
How many types of generations are there in a garbage collector?
Explain the difference between the while and for loop. Provide a .net syntax for both loops?
Explain dataset.acceptchanges and dataadapter.update methods in .net?
Why you want to leave your previous company.
How do I use the thread pool?
How does cas works?
What is Complex Class in .NET?
How to debug failed assembly binds?
Explain the features that are common to all .Net languages.
What is COM Interoperability in .NET
Explain the difference between the while and for loop.
What is boxing and un-boxing in .net?
Tell me what is a “jagged array”?
What is a variable of implicit type and what is its scope?