Obviously the following is totally fine in c#;
int a;
int b = a = 2;
Is it possible to do multiple variable assignments in c# in a single statement?
i.e. something like;
int a = (int b = 2);
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.
If we look at:
That is essentially
a=2;thenb=a;(but without an extra eval). So we can get similar by reversing the order:However: I would say take this a bit hesitantly: please also prioritise readability.