# 常规类型系统和公共语言规范Common Type System & Common Language Specification

## 常规类型系统Common Type System

• 建立用于跨语言执行的框架。Establish a framework for cross-language execution.
• 提供面向对象的模型，支持在 .NET 实现上实现各种语言。Provide an object-oriented model to support implementing various languages on a .NET implementation.
• 定义处理类型时所有语言都必须遵守的一组规则。Define a set of rules that all languages must follow when it comes to working with types.
• 提供包含应用程序开发中使用的基本基元数据类型（如 BooleanByteChar 等）的库。Provide a library that contains the basic primitive types that are used in application development (such as, Boolean, Byte, Char etc.)

CTS 将定义应支持的两种主要类型：引用和值类型。CTS defines two main kinds of types that should be supported: reference and value types. 其名称表明了其定义。Their names point to their definitions.

CTS 将定义多个类型类别，每个类别均有其特定的语义和用法：CTS defines several categories of types, each with their specific semantics and usage:

• Classes
• 结构Structures
• 枚举Enums
• 界面Interfaces
• 委托Delegates

CTS 还将定义类型的所有其他属性，例如访问修饰符、有效的类型成员以及继承和重载的工作原理等。CTS also defines all other properties of the types, such as access modifiers, what are valid type members, how inheritance and overloading works and so on. 遗憾的是，有关上述任意一点的深入介绍已超出此类介绍性文章的介绍范围，但可以参阅底部的更多资源部分，获取包含这些主题的详细内容的链接。Unfortunately, going deep into any of those is beyond the scope of an introductory article such as this, but you can consult More resources section at the end for links to more in-depth content that covers these topics.

## 公共语言规范Common Language Specification

CLS 是 CTS 的子集。CLS is a subset of the CTS. 这意味着，CTS 中的所有规则也适用于 CLS，除非 CLS 规则更严格。This means that all of the rules in the CTS also apply to the CLS, unless the CLS rules are more strict. 如果仅使用 CLS 中的规则生成组件（即在其 API 中仅公开 CLS 功能），则将该组件视为 符合 CLSIf a component is built using only the rules in the CLS, that is, it exposes only the CLS features in its API, it is said to be CLS-compliant. 例如，<framework-librares> 完全符合 CLS，因为它们需要对 .NET 支持的所有语言有效。For instance, the <framework-librares> are CLS-compliant precisely because they need to work across all of the languages that are supported on .NET.