what is the main differnce between const,readonly and static

Answer Posted / komilla shaheen

const is the keyword where we can intialize the variable
with some value which is constant throughout the program it
cannot be changed.
static is the keyword which is intialized at complile time
and had to change at compile time only.
readonly is for the varible which is readonly cant be
changed.

Is This Answer Correct ?    9 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the use of ienumerable?

621


Are all methods virtual in c#?

696


List the two important objects of ado.net and also list the namespaces that are commonly used in ado.net to aid in connection to a database.

683


Why do we use namespace in c#?

682


Why is c# good for games?

709






How to sort an int array in c#?

708


Which are the loop types available in c#?

652


How many types of constructors are there?

657


How many bytes is a char c#?

639


What is difference between association, aggregation and inheritance relationships?

669


What is the use of static members with example using c#.net.

662


What is the value which is accepted by all data types ?

719


What are the different types of delegation?

614


What is the purpose of static?

680


How Is The Dll Hell Problem Solved In .net?

751