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

Are structs value types c#?

658


Write down the c# syntax to catch an exception

699


Which is faster list or dictionary in c#?

738


Is string a primitive data type in c#?

653


What is jit? What are the different types of jit?

779


What is event and delegates in c#?

755


How big is int16?

701


Is an array an object c#?

725


What is static classes in c#?

711


How can encapsulation be achieved?

820


What is Named parameter in C#?

748


What is session management in c#?

738


What is a class in unity?

669


What is Dependency of Injection?

714


How many types of constructor are there in c#?

654