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 the concept of inheritance in .net?

0 Answers  


What is serialization in .NET? What are the ways to control serialization?

1 Answers  


Explain me what is a design pattern and what is it for?

0 Answers  


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

0 Answers  


What are an object and a class?

0 Answers  






What does jit compilation do in .net?

0 Answers  


hai, about trading domain and need simple project on trading system. please help me...

0 Answers  


What is difference between .net core and .net standard?

0 Answers  


Is .net an object oriented language? What are their components?

0 Answers  


Is .net a language?

0 Answers  


What does msil do?

0 Answers  


Explain the Difference between value and reference type.

2 Answers   Infosys, Wipro,


Categories