Was just watching a video of a rather great Microsoft instructor, Mike Taulty. In his videos he consistently surrounded his return values with parentheses, even single values:
return (null);
Is there some hidden benefit with IntelliSense, or maybe something with the compiler, that this provides?
Code below:
public ObservableCollection<MailViewModel> Emails
{
get
{
return (emails);
}
set
{
emails = value;
}
}
Like in math, anything inside parenthesis gets handled first. So for a simple return statement they are not needed.
{} are used to define a dictionary in a "list" called a literal parentheses in java: Parentheses are used for two purposes: (1) to control the order of operations in an expression, and (2) to supply parameters to a constructor or method. ................. and many more in simple: A parenthesis is a punctuation mark ...
A parenthesis is a punctuation mark used to enclose information, similar to a bracket. The open parenthesis, which looks like (, is used to begin parenthetical text. The close parenthesis, ), denotes the end of parenthetical text. The plural of parenthesis is parentheses.
There is certainly no performance difference because both forms translate to the same IL. The runtime couldn't tell even if it wanted. You can use Reflector or ILdasm or any other decompiler to look at the generated IL.
There is no intellisense benefit or detriment.
The semantics are also exactly identical.
I will not discuss whether it is better style or not because that discussion does not belong on Stack Overflow. It is also a matter of personal taste.
There's no benefit wrt the code generated. You can verify this by looking at the IL generated. As for whether it improves readability or not, that is subjective.
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