Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Coding style is a set of guidelines that helps readability and understanding of the source code.
21
votes
Accepted
Should I prefer properties with or without private fields?
There are a couple instances where the so-called "older" style is still required:
A: Immutable types using language-provided immutability. The readonly modifier in C# freezes that value after constru …
5
votes
Accepted
coding style for If condition
This is legal in C# and is colloquially known as a Yoda Condition. Many people in the C/C++ world like this because it guards at compile time against replacing == with = by accident. However, it has f …
3
votes
Worst coding standard you've ever had to follow?
At a previous job, the C# standard was to have at least two spaces between type name and variable name in declarations, the method name must begin on the next line from the access modifiers and return …
3
votes
Should I make a variable readonly when I modify it, but I don't actually set it outside of t...
I say yes, add the readonly. For two reasons:
if you (or a teammate in the future) try to reassign to that variable in a later method, it will give you a compile-time error. R# will note the error e …
3
votes
Accepted
Microsoft's coding standards for ASP.NET controls
I'm for your second entry, AddressLabel. For a couple reasons. One, I believe that the Hungarian Notation first one is out of favor in a big way. Next, I believe that a lot of times labels precede inp …
0
votes
Create new variable or make multiple chained calls?
I prefer the second way as well because it shows intent. You are getting the name and it off of a single item you have retrieved.
In the first way, could there exist a possibility (e.g. via another t …