John likes simple variable names and short code. Jake believes in descriptive names and leveraging existing libraries like LINQ. Who is right? Both of them!
If John compiles this with msbuild /p:DefineConstants="john", Jake’s code will not be included in the compilation process, because the if won’t trigger. More information on how preprocessor symbols work in C# here. Other languages also have preprocessor directives and symbols, so look up your own.
Multiple usernames won’t work - the compiler complains two methods called Multiply are defined. This is because now both #if checks are true. We can simplify and use MSBuild’s built-in variables. No need to have each developer change the .csproj on their end.
Now whichever Windows user does the compilation, either manually through a terminal or inside Visual Studio, will have their code run instead of their rivals’. It’s easier to find bugs this way too, you always know who’s responsible.
You can also have different symbols in Debug and Release, in case you want only one person’s changes to be in the official Release build.