Search code examples
c#.netcommand-line-interfacecls

C# classes interoperate with other .NET languages


Is there a way to ensure that other .NET languages will interoperate with my C# classes ?


Solution

  • The most important thing would be for you to use the CLSCompliantAttribute. This prevents you from inadvertently using non CLS compliant features in C#.

    There are a few pretty obvious rules that I can mention here. Note, this list is not exhaustive. I just wanted to point our some of the rules to give you a feel of what CLS compliance is all about.

    • Do not use unsafe types (pointers) in the public interface.
    • Do not mix member name casing in the public interface.
    • Do not use unsigned types in the public interface.

    Read the article Cross Language Interoperability for more information.