C# (Sharp) Programming Language Question:

Download Job Interview Questions and Answers PDF

What is the difference between const and static read-only?

C# (Sharp) Programming Language Interview Question
C# (Sharp) Programming Language Interview Question

Answer:

The difference is that static read-only can be modified by the containing class, but const can never be modified and must be initialized to a compile time constant. To expand on the static read-only case a bit, the containing class can only modify it: -- in the variable declaration (through a variable initializer).
-- in the static constructor (instance constructors if it's not static).

Download C# (Sharp) Programming Language Interview Questions And Answers PDF

Previous QuestionNext Question
Is there a way of specifying which block or loop to break out of when working with nested loops?What does the parameter Initial Catalog define inside Connection String?