-
Notifications
You must be signed in to change notification settings - Fork 76
Code Guidelines
John Michael Gross edited this page Jul 6, 2017
·
5 revisions
- Types: PascalCase
- Prefix interfaces with "I"
- Suffix delegates with "Del"
- Methods: PascalCase
- Method names should generally use verbs in the infinitive tense, for example
GetValue()
orOpenFile()
. Callbacks and events should use present continuous (-ing) or past tense depending on the context.
- Method names should generally use verbs in the infinitive tense, for example
- Non-Private Members: PascalCase
- Private Members: _camelCase
- One type per file with the exception of nested types and delegate declarations.
- No public fields except for consts, use properties instead
- No stateful static types. These are a pain to clean up, static types should not store any information.
- Use dependency injection when possible. Most Torch code uses constructor injection.
-
Events and actions should be null checked before calling or invoked with the
action?.Invoke()
syntax.
- All types and members not marked private or internal should have XML documentation using the
/// <summary>
tag.- Interface implementations and overridden methods should use the
/// <inheritdoc />
tag unless the summary needs to be changed from the base/interface summary.
- Interface implementations and overridden methods should use the