Okay, so I've known about this for like 600 years now, but I've only just now cared to wonder why.
Why, in C# can we assign to a string like this?:
string f = "u";
AND ALSO:
string n = ("ny");
Is there any difference? I've not noticed any, but I always use ""; without the parentheses.
There is not any difference. The parenthesis can be used in any expression to explicitly define precedence of the operations. For your simple case, the expression is the string itself, so there is no need for the parenthesis. There is no difference in the compiled IL.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With