What is the difference between readonly and const
Answer Posted / sabina
both meant for constant values. a const field can only be
initialized at the declaretion of the field. a read only
field can be initialized either in initialization or in
constructer. therefore , reaadonly field can have different
values depending on the constructure used
also a const field is compile time constant , readonly
field can be used for runtime constants
Is This Answer Correct ? | 18 Yes | 2 No |
Post New Answer View All Answers
Why do we need to call CG.SupressFinalize?
What is difference between singleton and static class in c#?
What is c sharp language?
What is routing in c#?
What are the collection types can be used in c#?
What is the console on a mac?
What does writeline mean?
What are Regex / regular expressions ?
What is linq c#?
Why do I get a security exception when I try to run my c# app?
Is c# used for frontend or backend?
What is the use of nullable types in c#?
Is int reference type c#?
Name the connections does microsoft sql server support?
How do you remove white spaces from a string?