Skip to main content

ReadOnly Properties in .net

There is nothing like readonly properties because readonly keyword is applied only to field members. and readonly members are initialized only in the constructors. 

We can have properties which has only get block and no set block which allows only to return the values but not set or assign the value. 


Ex:
private int _i=5;
public int i //this property allows to get the value of _i variable but we cant set the value of _i.
{
   get
   {
      return _i;
    }
}

Popular posts from this blog

Resolving 'Setup Account Privileges' error while installing SQL Server

A new installation of Microsoft SQL Server 2012 or Microsoft SQL Server 2008 R2 fails You see the following error message when you try to install a new instance of SQL Server 2012 or SQL Server 2008 R2: Rule "Setup account privileges" failed.

Creating package in Oracle Database using Toad For Oracle

What are Packages in Oracle Database A package is  a group   of procedures, functions,  variables   and  SQL statements   created as a single unit. It is used to store together related objects. A package has two parts, Package  Specification  and Package Body.