In order to become good programmers, we need to use a consistent coding style. When our code is consistent, we can focus on what the code does instead of how it's written. Errors are more apparent when debugging and it's easier to collaborate with other developers.
Here are some general C# coding guidelines to follow from the dotnet/corefx Coding Style documentation:
if (someVar == 0) . . .
, where the dots mark the extra free spaces._
and use camelCase for all private field names.private string Description
, not string Description
.Item newItem = new Item(...)
, since the type of newItem
is Item
. We should not use the code var newItem = new Item(...)
since the type of newItem
is Item
. In general, var
is too vague and shouldn't be used.if (someVar == 0) . . .
, where the dots mark the extra free spaces._
and use camelCase for all private field names.private string Description
, not string Description
.Item newItem = new Item(...)
, since the type of newItem
is Item
. We should not use the code var newItem = new Item(...)
since the type of newItem
is Item
. In general, var
is too vague and shouldn't be used.
Lesson 7 of 12
Last updated more than 3 months ago.