Question

Quick question, I've been reading about some .Net stuff and the way some people talk implies on me that a .Net library could be used with multiple .Net languages. Maybe it's just wishful thinking on my part lol. For instance could I use the Tao Framework, programmed in C#, with the Boo .Net language?
The only way I could explain it is if the library is compiled to bytecode to run in .Net and can be used with any language that also compiles too. I don't know very much about .Net though ^-^

Thanks

Was it helpful?

Solution

Any assmebly (IL code and manifest) can be used in any .NET language - it doesn't matter what language it was written in, so long as the code is CIL compliant and conforms to the CLS (Common Language Specification).

From MSDN (CLS):

To fully interact with other objects regardless of the language they were implemented in, objects must expose to callers only those features that are common to all the languages they must interoperate with. For this reason, the Common Language Specification (CLS), which is a set of basic language features needed by many applications, has been defined. The CLS rules define a subset of the Common Type System; that is, all the rules that apply to the common type system apply to the CLS, except where stricter rules are defined in the CLS. The CLS helps enhance and ensure language interoperability by defining a set of features that developers can rely on to be available in a wide variety of languages. The CLS also establishes requirements for CLS compliance; these help you determine whether your managed code conforms to the CLS and to what extent a given tool supports the development of managed code that uses CLS features.

OTHER TIPS

If I understood your question right, then you can create a .NET library in, say, C# or Delphi Prism, compile it to IL and get an assembly. Then you can reference and use this assembly in your VB.NET project.

There are limits to interoperability. In particular if the type system underlying different languages differs significantly. But Boo and C# are very similar apart from the syntax, so there should be no problems between these.

We use C# helper libraries in our VB.Net project without issue - A single project can only handle a single language but a solution can contain multiple projects each using their own language (or reference any assembly written in any language that compiles to MSIL) with full VS debugging functionality

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top