Wednesday, May 11, 2011

Difference between static variable and constant in c#?

Static Variable:
1.Variable set at run time
2.Can be assigned for reference types.
3.Initialized on constructors

Constant:
1.Variable set at compile time itself.
2.Assigned for value types only
3.must be initialized at declaration time
4.only primitive data types.

No comments:

Post a Comment