Interview Questions

How is a property designated as read-only?

ASP.NET and .NET WEB Questions and Answers


(Continued from previous question...)

How is a property designated as read-only?

In VB.NET:
Public ReadOnly Property PropertyName As ReturnType
Get ‘Your Property Implementation goes in here
End Get
End Property

in C#
public returntype PropertyName
{
get{
//property implementation goes here
}
// Do not write the set implementation
}

(Continued on next question...)

Other Interview Questions