Constant keyword:- The const keyword is by default static. The value of your const property is set at compile/initialize time and can't change/ modified at run-time i.e. public class Constants { public const string ICONSTVALUE = "Const" ; } Stayed Informed - 5 Best C# Constructor Questions and Answers Read-only keyword:- The read only keyword can be declared as static but not necessary. No need to initialize at the time of declaration. Its value can be changed using constructor i.e. public class ConstVsReadonly { public readonly string IREADONLVALUE; public ConstVsReadonly () { IREADONLVALUE = "Readonly" ; } } For example for both const and read only keyword:- public class ConstVsReadonly { public const string ICONSTVALUE = "Const" ; public readonly string IREADONLVALUE; public ConstVsReadonly () { IREADONLVALUE = "Readonly" ; } } S...
Angular, React, JavaScript, Java, PHP, SQL, C#, Vue, NodeJs, TypeScript and Interview Questions Answers