Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


what is read only and constant

Answers were Sorted based on User's Feedback



what is read only and constant..

Answer / aravind

constant : it ll take the values at compile time ,,in
constant u cant change values .....


Read-Only : i ll take values at run time espessailly u can
use this for date functions

Is This Answer Correct ?    5 Yes 1 No

what is read only and constant..

Answer / rafi

if we use constantat first only value should be assigned
where as
in readonly the value can be assigned any time but it
should not be modified

Is This Answer Correct ?    4 Yes 1 No

what is read only and constant..

Answer / vathsala

A quick synopsis on the differences between 'const'
and 'readonly' in C#:

'const':
1.Can't be static.
2.Value is evaluated at compile time.
3.Initiailized at declaration only.

'readonly':
1.Can be either instance-level or static.
2.Value is evaluated at run time.
3.Can be initialized in declaration or by code in the
constructor.

Is This Answer Correct ?    3 Yes 0 No

what is read only and constant..

Answer / bhuvana

Read Only and Constant are like variables whose value once
given (initialized) cannot be changed.

The difference between Read Only and Constant is that
Constant can only be initialised at the time of declartion
but
Read Only field can be initialised at the time of
declartion or in constructor.

Is This Answer Correct ?    4 Yes 3 No

what is read only and constant..

Answer / ganesh

a constant must be initialized at the time of decleration
and this value cannot be changed anywhere in the program.

whereas a readonly can be initialized at anywhere in the
program and the value can be changed

Is This Answer Correct ?    3 Yes 2 No

what is read only and constant..

Answer / xiaof

A const field can only be initialized at the declaration of
the field. A readonly field can be initialized either at
the declaration or in a constructor. Therefore, readonly
fields can have different values depending on the
constructor used. Also, while a const field is a compile-
time constant, the readonly field can be used for runtime
constants as in the following example:
public static readonly uint l1 = (uint) DateTime.Now.Ticks;

Is This Answer Correct ?    1 Yes 0 No

what is read only and constant..

Answer / payal mehta

A constant value must be initialized at the time of
declaration
and this value cannot be changed anywhere in the program.

A Read-only value can be assigned any time but it
should not be modified anywhere in the program.we can only
view not edit its value.

Is This Answer Correct ?    1 Yes 0 No

what is read only and constant..

Answer / nithya

A readonly can be initialized only the time of variable
declaration or only in the constrator,Apart from that we
cannt modify anywhere in our program.

But Constant must be initialized at the time of declaration.
And this value cannt be changed in constractor level also.

Is This Answer Correct ?    1 Yes 2 No

Post New Answer

More C Sharp Interview Questions

What is use of FormBoarderStyle Propertie

0 Answers   MCN Solutions,


What are the different types of assemblies available and their purpose?

0 Answers  


Can we inherit a class with private constructor in c#?

0 Answers  


Why do I get an error (cs1006) when trying to declare a method without specifying a return type?

0 Answers  


Why do we need static class in c#?

0 Answers  


How many constructors can a class have in c#?

0 Answers  


What does static mean in c sharp?

0 Answers  


What is the advantage of dependency injection?

0 Answers  


Write the difference between TypeOf and GetType?

0 Answers   Wipro,


What does out mean in c#?

0 Answers  


What are the Features in .net framework 1.1

0 Answers   Digital GlobalSoft,


Should I make my destructor virtual?

0 Answers  


Categories