posts - 236, comments - 436, trackbacks - 56

My Links

News

Awarded Microsoft MVP C#.NET - 2007, 2008 and 2009


I am born in Bangladesh and currently live in Melbourne, Australia. I am a Microsoft Certified Application Developer MCAD Chartered Member (C# .Net)and born in Bangladesh.
I am founder and Chief Executive Officer of
Simplexhub, a highly experienced software development company based in Melbourne Australia and Dhaka, Bangladesh. Co-founder and core developer of Pageflakes www.pageflakes.com.
Simplexhub, is on its mission to build a smart virtual community in Bangladesh and recently launched beta realestatebazaar.com.bd an ASP.NET MVC application written in C#.NET.


Some of My Articles
Flexible and Plugin based .Net Application..
Mass Emailing Functionality with C#, .NET 2.0, and Microsoft® SQL Server 2005 Service Broker'
Write your own Code Generator or Template Engine in .NET

Archives

Free Programming Language Training

CLS - Common Language Specification, consider making your code CLS compliant.

Making your code CLS compliant is important, as this confirms that the classes should only expose features that are common to the CLS. So anyone using your classes and writing in a different programming language do not face any issues.

To make sure, CLS compliancy is checked by the C# compiler we have to explicitly define the CLSCompliantAttribute.

Marking inside AssemblyInfo.cs class
===================================
[assembly: CLSCompliant(true)]

Marking an entire assembly as CLS compliant
=========================================
using System;
[assembly:CLSCompliant(true)]

Marking a particular method as CLS compliant
=========================================
[CLSCompliant(true)] 
public void MyMethod()

Remeber you have to be extra careful when you enable CLS compliancy else C# compiler to raise an error , here are some examples :

1. When your class methods that are identical but differ only by ‘out’ or ‘ref’.
2. When a publicly exposed member starts with an underscore (_).
3. When an abstract member is marked for non-CLS compliance within a CLS compliant class.

And we should stick to the following rules:
=======================================

1. Unsigned types should not be part of the public interface of the class. However unsigned types can be part of private members. 
2. Unsafe types like pointers should not be used with public members. However they can be used with private members. 
3. Class names and member names should not differ only based on their case. For example we cannot have two methods named TheMethod and THEMETHOD. 
4. Only properties and methods may be overloaded, Operators should not be overloaded.

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Print | posted on Thursday, January 18, 2007 1:58 AM |

Feedback

No comments posted yet.
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification:
 
 

Powered by: