Naming conventions [Answered]
I am arguing with my friend about what casing to use in variable names. To settle the argument whatever the first naming convention that someone says (within reason say the actual one that you use) we will use
16 Replies
ie what to use on public, private and method params
C# Coding Conventions
Learn about coding conventions in C#. Coding conventions create a consistent look to the code and facilitate copying, changing, and maintaining the code.
C# has an official naming convention, why not use that?
you can also enforce the official coding conventions by fetching a
dotnet new editorconfig
to summarise it, types (classes, records, structs etc) and methods get
PascalCase
names, local variables and parameters get camelCase
names and private fields get _underscoreCamelCase
namesto add, fields should never be public
right. a "public field" should be a property instead, and those are also
PascalCased
fields should only ever be
private
, private protected
, or protected
. properties are protected internal
, internal
, public
feel like i'm missing one
the convention to add s_
to static things isn't a great one imoprotected
i don't do that personally
ok solved
dont do protected?
nah this i meant
to close your thread, use
/close
✅ This post has been marked as answered!
ah