简体   繁体   中英

C# Interface can be inherited in which languages?

We have designed an API which exposes a series of interfaces written in C#.

  • Apart from C# what languages can inherit from the C# interface?

The motivation behind this question is that we are writing the API documentation and would like to state which languages can utilise the interfaces we have written in C#.

For example can VB.NET or F# inherit an interface written in C#?

EDIT ----
I should note that I have since discovered the CLSCompliant attribute which forces the compiler to check for Common Language Specification (CLS) compliance at compile time. This is a useful attribute for public API's to ensure compliance with other .NET languages.

Link to article explaining the use of the CLSCompliant atribute

If you stick to CLS (Common Language Specification), you can inherit that interfaces in all CLS compliant languages. For example Visual Basic, F# are CLS compliant and can inherit C# classes and interfaces.

An example: You cannot have the same names which only differ by case - eg METHOD(), method(), Method(), mEtHoD()... these ones cannot be present together in one interface.

Some programming languages may support only older CLS specification. For example CLS 1.0 languages don't support generic types.

You can found more information on CLS requirements in MSDN.

http://msdn.microsoft.com/en-us/library/12a7a7h3.aspx

http://msdn.microsoft.com/en-us/library/a2c7tshk.aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM