what is the main differnce between const,readonly and static

Answer Posted / raja

1. we can initialize constant variable only at the
declaration where as readonly varaiable can be initialized
at either declaration or in constructor.

2. we can't use static modifier for the const variable
where as readonly variable can be declared as static

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

if we are updating a database using thread, and mean while application crashes or thread being aborted then what will happen in Database? Rollback or Database will be updated? Please explain with different scenario.

1924


How do we achieve encapsulation in c#?

488


What is int tryparse in c#?

526


What is asp net c#?

503


What is .dbml file?

483






Is an array an object c#?

542


What is an escape sequence?

516


What is iformatprovider in c#?

499


Why do we use dictionary in c#?

501


Why we use extension methods in c#?

471


What is a nested type. Give an example?

621


How do partial classes work in c#?

488


What is difference between abstraction and encapsulation in c#?

516


What are jagged arrays used for?

485


What are the types of serialization?

513