Do you know these C# conventions?

Is there a unique “good” way to write C#?

Mina Pêcheux
.Net Programming
Published in
5 min readJul 20, 2024

--

Photo by Nick Tiemeyer on Unsplash

When you program a project, the first step is always to have something that works. But then, when you’ve managed to implement your feature, it’s often a good thing to try and clean up your code…

… and, for example, you can make sure that it obeys the usual C# conventions to make it easier to understand by other collaborators, or contributors on an open source project!

So, today, let’s have a look at those and help make your next piece of software all fancy :)

Foreword

In this article, we’ll mainly discuss conventions from the Microsoft C# docs. But keep in mind that your team and project conventions, if they are already established, should always supersede this global reference. It is better that you and your colleagues understand each other and create consistent software, than that you alone follow some strict guidelines from an external source!

And, of course, the conventions I show here are just one possibility — feel free to react in the comments if you have some advice of your own!

How should you name your classes and variables?

--

--

Mina Pêcheux
.Net Programming

I’m a freelance full-stack web & game developer. I’m passionate about topics like CGI, music, data science and more! Find me at: https://minapecheux.com :)