Readonly vs. const?

Answers were Sorted based on User's Feedback



Readonly vs. const?..

Answer / pavan

both of them does the same work these value cannot be
changed
but with a samll difference
using const we can assign a value before compile time
but using readonly we can assign value to the varible ones
in runtime

Is This Answer Correct ?    14 Yes 0 No

Readonly vs. const?..

Answer / j_baghla

Both are used for constant values but in readonly variable
we can assign the value thru expression but we can't assign
value to constant variable thru expression.

Is This Answer Correct ?    5 Yes 1 No

Post New Answer

More Dot Net General Interview Questions

What is .net and why it is used?

0 Answers  


Do I have any control over the garbage collection algorithm?

0 Answers  


what is prototype design pattern in .net

0 Answers   Infosys,


Is .net 4.8 backwards compatible?

0 Answers  


How .NET is able to support multiple languages?

5 Answers  






Explain the use of activex control in .net?

0 Answers  


What is nmake tool?

1 Answers  


Differentiate between 'DataSet' and 'SQLDataReader' in ADO.NET?

0 Answers   QuestPond,


What is CLR? How it will work?

3 Answers   NeoSoft,


Explain about managed heap?

0 Answers  


How to use datagrid value in select statements where condition ,if cell is hyperlink bounded column?

0 Answers  


Dynamic Fonts

0 Answers  


Categories