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
Do you know what is linq?
Can any object be stored in a viewstate in .net?
What is the difference between .net 2000 and .net 2005(features)? Which one is better?
How many namespaces are in .net version 1.1?
Can I write il programs directly?
What is the difference between boxing and unboxing?
What is strong-typing versus weak-typing? Which is preferred?
What is meant by globalization and localization?
Explain how to load the contents of an xml file into an xmldocument object?
Explain what is the difference between constants and read-only variables?
How to implement datagrid in.net? How would you make a combo-box appear in one column of a datagrid? What are the ways to show data grid inside a data grid for a master details type of tables? If we write any code for datagrid methods. What is the access specifier used for that methods in the code behind file and why?
Describe the difference between inline and code behind which is best in a loosely coupled solution?
What are Attributes in .NET?
Explain webfarm vs webgardens in .net?
What are .net functions?