Tips n Tracks

  • Increase font size
  • Default font size
  • Decrease font size
  • default color
  • black color

Reference

Sample image

Microsoft .NET Framework Get Details.

Sample image

Microsoft .NET Framework Get Details.

Reference

Sample image Microsoft .NET Framework Get Details.
Sample image

Microsoft .NET Framework Get Details.


C# Coding Standards and Guidelines: Coding Practices


C# Coding Standards and Guidelines: Coding Practices

1. Use meaningful namespace such as the product name or the company name.

2. Avoid fully qualified type names. Use the using statement instead.

3. Avoid putting a using statement inside a namespace.

4. Group all framework namespaces together and put custom or third-party namespaces underneath.

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using MyCompany;
using MyControl;

5. A file name should reflect the class it contains.

6. Avoid putting multiple classes in a single file.

7. Always place an open curly ({) in a new line.

8. Avoid multiple Main () methods in a single assembly.

9. Maintain strict indentation. Do not use Tabs or non standard indentation. Such as one space. Recommended values are three or four spaces, and the value should be uniformed across.

10. A single file should contribute types to only a single namespace. Avoid having multiple namespaces in the same file.

11. Do not manually edit any machine generated code.

  • If modifying machine generated code, modify the format and style to match this coding standard.
  • Use partial classes whenever possible to factor out the maintained portions.

12. Make only the most necessary types public. Mark other as internal.

13. Avoid friend assemblies. As they increases inter assembly coupling.

14. Avoid code that relies on an assembly that running form a particular location.

15. Minimize code in application assemblies (EXE client assemblies). Use class libraries instead to contain business logic.

16. Avoid providing explicit values for enums.

//CORRECT
public enum Color
{
    Red,Green,Blue
}
//AVOID
public enum Color
{
    Red=1,Green=2,Blue=3
}

Pages: 1 2

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments

No comments yet.

Leave a comment

(required)

(required)

*
To prove that you're not a bot, enter this code
Anti-Spam Image