I’ve just been browsing a file in reflector and seen this in a struct constructor:
this = new Binder.SyntaxNodeOrToken();
I’ve not seen that terminology before. Can someone explain what that this assignment means in C#. It’s difficult to Google.
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.
It replaces the value, basically. It effectively copies all the fields from the right side to the left… except it works even if the fields are readonly. And yes, it does look distinctly weird, and it’s somewhat scary.
Example:
For more information, read section 7.6.7 of the C# 4 spec, which includes: