Interview Questions Answers.ORG
Interviewer And Interviewee Guide
Interviews
Quizzes
Home
Quizzes
Interviews Dot Net Technologies Interviews:.Net Architecture.Net Database.Net Deployment.NET web servicesADO.NETADO.NET 2.0ASP ProgrammingASP.NetASP.NET 2.0ASP.NET CachingASP.Net MVCBizTalkC# (Sharp) Programming LanguageCOM+Crystal ReportsDataGrid (Grid view)Dot NetDot Net AssemblyDot Net Code SecurityDot NET crystal reportsDot Net FrameworkDot Net RemotingDot Net WindowsFormsEntity FrameworkMicrosoft .Net MobileMicrosoft BasicsMicrosoft.NETMicrosoft.NET 2.0Mixed MicrosoftMono FrameworkMOSSMSFMTSReporting ServicesSenior .Net DeveloperVB .NetVB .Net DeveloperVB.NET FrameworkWCF (Windows Communication Foundation)WCF Data ServicesWeb Forms
Copyright © 2018. All Rights Reserved
Senior .Net Developer Interview Question:
Please explain the difference between constants and read-only variables?
Submitted by: MuhammadWhile constants and read-only variable share many similarities, there are some important differences:
☛ Constants are evaluated at compile time, while the read-only variables are evaluated at run time.
☛ Constants support only value-type variables (the only exception being strings), while read-only variables can hold reference-type variables.
☛ Constants should be used when the value is not changing during run time, and read-only variables are used mostly when their actual value is unknown before run time.
☛ Read-only variables can only be initialised at the time of declaration or in a constructor.
Submitted by: Muhammad
☛ Constants are evaluated at compile time, while the read-only variables are evaluated at run time.
☛ Constants support only value-type variables (the only exception being strings), while read-only variables can hold reference-type variables.
☛ Constants should be used when the value is not changing during run time, and read-only variables are used mostly when their actual value is unknown before run time.
☛ Read-only variables can only be initialised at the time of declaration or in a constructor.
Submitted by: Muhammad
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.
https://InterviewQuestionsAnswers.ORG.