What you want to see on DotNetFunda.com ?
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 43116 |  Welcome, Guest!   Register  Login
 Home > Interview Questions > C# Interview Questions > How can we make our C# classes to intero ...

How can we make our C# classes to interoperate with other .net languages ?

Interview question and answer by: Chvrsri | Posted on: 1/27/2011 | Category: C# Interview questions | Views: 1839 | | Points: 40


Answer:

We must make sure that our C# classes conforms to th Common Language Subset(CLS).

For this we need to add a global assembly to our C# source files

Which can be depicted as :

[assembly: CLSCompliant (true)]


If we use a C# feature which is not CLS-Compilant the compiler will emit an error.

Source: My Own !!! | Asked In: Many Interviews | Alert Moderator 
Found interesting? Add this to:


 Responses

Posted by: Questpond | Posted on: 27 Jan 2011 09:47:40 PM | Points: 10 | Alert Moderator 

Hello ,
CLS stands for common language specification and not subset.

If you follow CLS then any .NET language can call your code. For instance c# is case sensitive while VB.NET is not. So when you code in VB.NET something like this below

public sub x()


end sub

public sub X()

end sub


The above code will compile for VB.NET but C# will be confused as c# is case sentive and VB.NET is not. So what you need to do is go in your assemblyinfo.cs and put the below attribute.

[assembly: CLSCompliant (true)]


With the above code any kind of CLS compliance you break you will get a warning.


http://www.questpond.com/dotnet/Top-Dot-Net-Interview-Questions-and-Answers-Part1.html

>> Write Response - Respond to this post and get points

Even more ... | Submit Interview Questions and win prizes!

More Interview Questions from Chvrsri

Even more ... | Submit Interview Questions and win prizes!


About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/21/2013 8:32:01 AM