Writing a Cross-Language Program

The whole purpose of CLS compliance is to create a common specification for multiple languages to interoperate. According to the CLS standard, any CLS-compliant program can be compiled into a dll and used by any other CLS-compliant language. The base class libraries, written in different languages, prove that this works. To demonstrate the cross-language interoperability features, I've provided a program composed of objects from JScript.NET, Managed C++, Visual Basic.NET, and C#. Listings 35.13, 35.14, 35.15, 35.16, and 35.17 show objects written in each of these languages.

Listing 35.13. A Jscript Class: clJS.js
 // JScript class to be used in C# public class clJS { public var Greeting : String; function clJS() ...

Get C# Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.