Kodeco Forums

Introducing the raywenderlich.com C# Style Guide

The Unity Team at raywenderlich.com has grown a lot in the past year. At this point, we’ve released over 20 free Unity tutorials, and even a brand new Unity book. Now that the team has grown, we want to make sure we keep our style consistent, following the modern C# and Unity conventions developers are […]


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/785-introducing-the-raywenderlich-com-c-style-guide

Hi there

What is the reason to invent your own coding style? Instead of using the Microsoft C# coding style, that people are use to?

/Søren a C# developer-

Hi @thediver !

This style guide conforms with both Microsoft and Unity C# standards as much as possible. Before this, we had a style that was much more like Java.
If there are any exceptions, they’re there to increase readability for the tutorials and books.

Are there any specific points you disagree with?

Cheers!
Eric

Hi,

good stuff like it so far.

But for the switch statement you need to put the “{” in the extra line.
I would also put one empty line between the statements for readability

switch (variable)
{
case 1:
break;

case 2:
    break;

}

One additional style to think about:
private methods in camelCase.
internal and public methods in PascalCase

Cheers
Sascha

This tutorial is more than six months old so questions are no longer supported at the moment for it. We will update it as soon as possible. Thank you! :]