Saturday, March 24, 2018

Readonly and Constant in C#

Constant: Constant fields are define at the time of declaration and once they are defined can't be changed.
NOTE:
  1. This can't be declared static.
  2. Local scope 
  3. This is implicitly static variable.
  4. This must to initialised
Readonly: Readonly can be initialised either at the time of declaration or within the constructor of the same class and change the value in the same class constructor.


No comments:

Post a Comment

Hash Table in C#

 The Hashtable is a non-generic collection and used to store the key/value pairs based on the hash code of the key. Key will be used to acce...