Is there any C# naming convention for a variable used in a property?

后端 未结 12 1689
无人及你
无人及你 2021-01-31 07:26

Let\'s say, we have a variable, which we want named Fubar

Let\'s say that Fubar is a String!

That means, we would define F

12条回答
  •  终归单人心
    2021-01-31 08:08

    The nice thing about coding standards is that there are so many to choose from:

    • http://www.google.com/search?q=c%23+coding+standards
    • http://blogs.msdn.com/b/ericgu/archive/2004/01/19/60315.aspx
    • http://www.amazedsaint.com/2010/11/top-6-coding-standards-guideline.html

    Pick a convention that suits you and use it consistently.

    The Microsoft convention — pascalCase private fields and CamelCase properties is tidy, but can lead to bugs due to typos. I find the leading underscore convention annoying as it requires two additional key strokes every time you type the name, but you don't get the typos so much (or at least the compiler catches them first).

提交回复
热议问题