Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

192
Views
Using of Keywords as variable names

Why does the first line compile and the second not?

string var = "123";

var string = "123";

I mean string and var should be both keywords..

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

var is a contextual keyword, whereas string is not.

Contextual keywords are

used to provide a specific meaning in the code, but it is not a reserved word in C#.

This is why you can use var as a variable name.

Presumably, this is for backwards compatibility. If var were introduced as a proper keyword, old code that uses var as a variable name would break.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!