Interviews2 answers
Tell me Guys.. Can Object will be Constant or Readonly....?
2 Answers
Constants
Constants are static by default
They must have a value at compilation-time (you can have e.g. 3.14 * 2, but cannot call methods)
Could be declared within functions
Are copied into every assembly that uses them (every assembly gets a local copy of values)
Can be used in attributes
Readonly instance fields
Must have set value, by the time constructor exits
Are evaluated when instance is created
Urukundappa GudisePosted Oct 27, 2013, 9:40 AM EDT
objects can only be readonly.
PoornimaPosted Aug 6, 2013, 3:27 AM EDT
