For contributors.
We use C# 6.0 features to make our code more readable and refactor friendly.
- Home: Look for both
USERPROFILE
(Windows) andHOME
(everything else). - New line literals: Use
Environment.NewLine
and not\n
or\r\n
. @""
line breaks: Use intentionally when line breaks CRLF is unimportant. This captures the code's line break (CRLF or LF) which may vary depending on git settings. This is related to the previous item.- File paths: Use
Path.Combine
orPath.DirectorySeparatorChar
when possible. If you must, use a forward-slash because Windows is more forgiving than OS X/Linux. - Least common denominator: we prefer APIs that work on .NET Framework, .NET Core, and Mono to using
#ifdef
for different runtimes
- Don't hard code configuration settings that may need to change for different machines e.g. passwords, IP addresses, or absolute file paths.
For example,
(localdb)\\MSLocalDB
is not guaranteed to exist. Make DB configurable.