Showing posts with label Difference between constant and read-only in C#. Show all posts
Showing posts with label Difference between constant and read-only in C#. Show all posts

Friday, 11 May 2018

Difference between constant and read-only in C#


                             Constant and readonly keywords in C# are used to maintain the value throughout the application without any change. But constant should be assigned a value at the time of declaration only, but there is no need to assigned value at the time of declaration of readonly variable, can be assigned a value in constructor. The following example shows below clarifies about the constant and readonly.