Follow in Twitter & Facebook

Like in Facebook

Powered By Blogger Widgets

Free Download

FREE Tools

Wednesday, February 15, 2012

Basic difference between Constant and readonly

This is a basic question we are facing while giving interview. So lets discuss the basic difference between Constant and Readonly in C#.Net.

(1)- It cannot be static.

(2)- Value is evaluated at compile time or must be initialized at the time of creation or compile time.

(3)- Initialized at declaration only.

(1)- It can be either instance-level or static.

(2)- Value is evaluated at runtime.

(3)- Can be initialized in declaration or by code in the constructor.

You can also check Difference between cookie and session in

0 on: "Basic difference between Constant and readonly"