Skip to content

Code style

Mircea Teodor Oprea edited this page Oct 13, 2020 · 1 revision

Unless specified otherwise, always follow the C# Coding Conventions defined by Microsoft.

General rules

This is a list of general rules to follow when writing code for this project. When in doubt, look at similar classes in the project and try to follow the same structure. Otherwise, just ask for guidance :) There might be additions to these rules as the project progresses.

Naming

Always use names that clearly indicate what your class/method/variable is supposed to represent.

Public members

Use PascalCase when naming methods, public fields and properties.

Private members

Private methods should still follow the PascalCase, similarly to public members.

Private fields should use the camelCase, prefixed with an underscore, like this: private readonly DbContext _dbContext.

Interfaces and actual implementations

Keep interface names generic and class names specific.

As an example, do not name your interface ITheNewBostonAPIWrapper and a class TheNewBostonAPIWrapper.

Instead, name them IAPIWrapper and TheNewBostonAPIWrapper.

Clone this wiki locally