Often developers are not sure how to name things (e.g. fileName or filename, barCode or barcode). Here it is how you should do it:
1: //-----------------------------------------------------------------------
2: // <copyright file="Naming.cs" company="hfrmobile.com">
3: // Copyright (c) by Harald-René Flasch
4: // </copyright>
5: //-----------------------------------------------------------------------
6:
7: using System;
8:
9: namespace FxCopTests
10: {
11: /// <summary>
12: /// Avoid creating compound words from terms which exist in the dictionary as discrete terms.
13: /// Do not create a compound word such as 'StopWatch' or 'PopUp'. These terms are recognized
14: /// in the dictionary and should be cased as 'Stopwatch' and 'Popup'.
15: /// </summary>
16: public static class Naming
17: {
18: // CA1702: CompoundWordsShouldBeCasedCorrectly (NOT: EMail)
19: public static string Email
20: {
21: get { return "harald-rene.flasch@hotmail.com"; }
22: }
23:
24: // CA1702: CompoundWordsShouldBeCasedCorrectly (NOT: barCode)
25: public static string GenerateBarcode(string barcode)
26: {
27: return barcode;
28: }
29:
30: // CA1702: CompoundWordsShouldBeCasedCorrectly (NOT: unLoad)
31: public static string UnloadList(string list)
32: {
33: return list;
34: }
35:
36: // CA1702: CompoundWordsShouldBeCasedCorrectly (NOT: multiLingual)
37: public static string GenerateLanguage(string multilingual)
38: {
39: return multilingual;
40: }
41:
42: // CA1702: CompoundWordsShouldBeCasedCorrectly (NOT: filename)
43: public static string GenerateFile(string fileName)
44: {
45: return fileName;
46: }
47:
48: // No rule for Cleanup/CleanUp?
49: public static void CleanUp()
50: {
51: }
52:
53: // CA1702: CompoundWordsShouldBeCasedCorrectly (NOT: SetUp)
54: public static void Setup()
55: {
56: }
57:
58: // CA1702: CompoundWordsShouldBeCasedCorrectly (NOT: firstname, lastname, ...)
59: public static string GetFirstName(string firstName)
60: {
61: return firstName;
62: }
63:
64: // CA1702: CompoundWordsShouldBeCasedCorrectly (NOT: eMail)
65: public static string GetMailAddress(string email)
66: {
67: return email;
68: }
69: }
70: }
If you are not sure how to name other things you should consider using Microsoft FxCop! Also if you are not sure how to format your code Microsoft StyleCop will be your friend!