Is there any difference between auto-implemented properties and manually implemented ones, from a performance point of view?
Is there any difference between auto-implemented properties and manually implemented ones, from a performance
Share
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.
Auto-properties aren’t created at runtime, they are generated at compile time. Very much like
using, they are helpful syntactic sugar to reduce the amount of typing you need to do. They simply translate into code you would have written manually anyway.There is no performance difference. Aside from the backing field name, the resulting code is the same as if you did it manually.
As @dasblinkenlight highlights, the backing name, being a “safe name” (as in, could never create it in C#) can cause serialization issues where the name cannot be handled correctly.