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
To allow an element to be accessed using a unique key which .NET collection class is used ?
What is the difference between static class and singleton class in c#?
What is threading in c# with example?
Why c# is called type safe language?
What is callback function in c#?
What is thread in c#?
Why we use get set property in c#?
Is c# difficult to learn?
What problem does Delegate Solve?
Why do canadians say zed?
Why generics are used in c#?
How main method is called in c#?
What Is A Satellite Assembly?
Does c# support a variable number of arguments?
Can hashset contain duplicates c#?