SIGN UP MEMBER LOGIN:    
ARTICLE

.NET Best Practices

Posted by Murali Poola Articles | Coding Best Practices September 17, 2008
The attached white paper with this article discusses .NET best practices.
Reader Level:
Download Files:
 

The attached white paper disucsses the following topics in terms of best practices in .NET and C#.

1.       Managed Heap and Garbage Collection Overview           

a.       Memory Allocation        

b.      De-allocation of Memory            

c.       Object Finalization          

d.      Generations in GC          

2.       Minimize Boxing and Unboxing

3.       Finalize() Method Implementation         

4.       Implement the Standard Dispose Pattern            

5.       Utilize using and TRy/finally for Resource Cleanup           

6.       Always Use Properties Instead of Accessible Data Members      

7.       Prefer readonly to const              

8.       Prefer the is or as Operators to Casts     

9.       Always Provide ToString()           

10.   Ensure that 0 is a valid State for Value Types      

11.   Consider overriding the Equals() method for value types             

12.   Understand the Relationships Among ReferenceEquals(), static Equals(), instance Equals(), and operator==       

13.   Avoid pre-allocating memory    

14.   Prefer Variable Initializers to Assignment Statements    

15.   Initialize Static Class Members with Static Constructors 

16.   Utilize Constructor Chaining       

17.   Prefer Small, Simple Functions  

18.   Avoid inefficient string operations          

19.   Prefer Single Large Assemblies Rather Than Multiple Smaller Assemblies             

20.   Locking and Synchronization guidelines

21.   Minimize Thread Creation           

22.   Do not set local variables to null.              

23.   Miscellaneous  

a.       Multithreading 

b.      erialization         

c.       Remoting           

d.      Security               

 

Login to add your contents and source code to this article
share this article :
post comment
 

nice doc

Posted by Anil Kumar May 09, 2012

Thank you for the Document if you have any more tips n best practices please post it thanks in advance vasancer@gmail.com

Posted by vasanth kumar Sep 05, 2010

Thanks for this excellent document. It was hard to find a lot of the .NET best practices all in one document.

Good job!

Posted by Nalin Jayasuriya Jun 05, 2009

thanks for sharing these tips with us.

Posted by jagdish kargwal Apr 22, 2009

Great Job

Posted by sivaraman S Apr 16, 2009
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor
PREMIUM SPONSORS
  • ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
    ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
Nevron Gauge for SharePoint
Become a Sponsor