-
Notifications
You must be signed in to change notification settings - Fork 16
Naming things
- Top level directories are kebab-case
- Directory names and file names are PascalCase, e.g. MyFile.cs
- Where possible the file name should be the same as the name of the main class in the file, e.g. MyClass.cs
- In general, prefer one core class per file
To differentiate words in an identifier, capitalize the first letter of each word in the identifier. Do not use underscores to differentiate words.
Capitalize the first character of each word (including acronyms over two letters in length), as shown in the following examples: PropertyDescriptor
, HtmlTag
Names of classes, methods, enumerations, public fields, public properties, namespaces:
PascalCase
Names of local variables, parameters:
camelCase
Names of private, protected, internal and protected internal fields and properties:
_camelCase
For casing, a “word” is anything written without internal spaces, including acronyms. For example, MyRpc instead of MyRPC.
Names of interfaces start with I, e.g. IInterface.
These conventions are mainly based on the Microsoft .NET Framework Design Guidelines.
These are noteworthy pages of these guidelines:
- Naming Guidelines: Overview
- Naming Guidelines: Capitalization Conventions
- Naming Guidelines: General Naming Conventions
The conventions for C# are also based on the Microsoft C# conventions:
Other popular conventions and guidelines (which are similar, but have some conflicting rules):
Microsoft themselves seem to have conflicting rules too:
- Microsoft Capitalization Conventions:
Do not use underscores to differentiate words, or for that matter, anywhere in identifiers. - Microsoft C# Coding Conventions:
Use camel casing ("camelCasing") when namingprivate
orinternal
fields, and prefix them with_
. - 🤔
The ultimate guide to contribute to Maroon
General
🏠 Home
📑 Software versions
🔬 Experiments
Workflow
🔗 Git workflow
Conventions
💬 Naming things
🗃️ Folder structure
📦 Including components
📃 Scripts
🌄 Scene Layout
🎨 Materials
🗿 3D Models
🔉 Audio
🔤 Typography
Documentation
🎮 Input
🏭 Generated laboratory
👪 Multiplayer