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 the difference b/w Readonly Variable and Constant
Variable?

Answer Posted / arun

constants are dealt with at compile-time, while static
readonly fields are set at the time they are evaluated at
run-time.
the constant value will need to be recompiled if the
constant value changes. Libraries referencing a static
readonly field will reference the field and not the value,
thus they will pick up any change in the field without the
need for recompilation
constants will only support value types plus the
special .NET ones string and null while Static readonly
fields are able to hold reference types too.
So, constants should be used when it is very unlikely that
the value will ever change, or if no external apps/libs
will be using the constant. Static readonly fields should
be used when run-time calculation is required, or if
external consumers are a factor

Is This Answer Correct ?    10 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to run a dos command in vb.net?

977


write a program to develop a graphic user interface application of marks book with students names and their names.the program should show the following options main menu,add student details,display student details,maximum mark and minimum mark.

1566


Explain option strict?

887


Explain the difference between c# and vb.net?

977


what is interface and when it is used?

2220


What is the difference between datagrid and gridview?

958


What’s the difference between private and shared assembly?

1065


What is visual basic.net culture?

958


Name a feature which is common to all .net languages?

952


Explain about the feature anonymous type?

940


Can you please explain the difference between dispose and finalize()?

945


How to execute VB.NET PROJECTS,VB6.0 PROJECTS AND write their test cases.Need Reply Urgently

2450


How to store images in sql server database through vb.net?

869


What is the main purpose of garbage collector?

881


What are the advantages of migrating to vb.net?

924