When using ‘var’ to declare variables in C#, is there boxing/unboxing taking place?
Also is there a chance of a runtime type mis-match when using var to declare variables?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No. using var is compiled exactly as if you specified the exact type name. e.g.
and
are compiled to the same IL code.