C# Code Style

Reference Code Standard

Follow Microsoft’s C# Coding Conventions which are based off of the dotnet/runtime C# Style Guidelines while using the dotnet/runtime .editorconfig file .

External APIs shall use xmldoc. This allows OpenAPI (API documentation specification) and tools like DocFX (MSDN style documentation tool) to create detailed documentation.

Implementing the Standard

  • This standard requires .NET 5 or higher and Visual Studio 2017 or higher to run out of the box.

  • Download the dotnet/runtime .editorconfig file and place it in the same directory as your solution file (SLN).

-- Solution Root Folder
---- .editorconfig file
---- .sln file
-------- Subfolders/Projects

Exceptions to the Standard

  • None

Businesses Using Language

BusinessCodebase
AgricultureTrimble Ag Desktop
AgricultureTrimble Ag Software (Web)
AgricultureDevice Licensing API
MEPEstimating, Contractor Solutions, Sysque, Nova, Accubid, ProDesign
BuildingsTekla Structures

Allowing Exceptions

If there needs to be an exception to the standard, it can be called out with a SuppressMessage attribute . This should be rarely needed. Example below:

[SuppressMessage("Performance", "CA1823:Avoid unused private fields")]
public class X
{

}