问题
What is the CIL, CTS, and CLS in .NET and what is the difference between them?
回答1:
CIL (Common Intermediate Language) is the byte code to which your C# or Visual Basic code is compiled. It's the "machine code" of the .NET execution engine.
The CTS (Common Type System) is the representation of types (classes and structures) at the compiled level. Basically, it's saying that all .NET languages will use a common way of representing types (classes and structures).
The CLS (Common Language Specification) is a set of constraints on APIs and a complementary set of requirements on languages. If a library is CLS-compliant (i.e. adheres to all the constraints), then any CLS-compliant language will be able to use that API. Conversely, a CLS-compliant language is guaranteed to be able to use any CLS-compliant library. For example, a CLS-compliant language is guaranteed to support Int32, so the CLS guarantees it's safe for library writers to use Int32 in their APIs.
来源:https://stackoverflow.com/questions/1997605/cil-cls-and-cts-in-net