. NET, have you forgotten (a)--CLS-compliant

Source: Internet
Author: User
Tags inheritance advantage

First, let's simply look at what is called the CLS.

In view of the personal English level, I will give the CLS the English explanation first, then I translate again:

The CLS is a specification which defines the rules to support language integration. This is doing in such a way, which programs written in any language (. NET compliant) can interoperate with one another. This also can take all advantage of inheritance, polymorphism, exceptions, and other features.

The CLS defines a specification that supports language inheritance, which enables us to interact with any of the. NET-compatible languages, which allows you to take advantage of inheritance, polymorphism, exceptions, and other features.

In fact, it is simplified to say that the CLS is defined as a subset of the language to ensure the interoperability of the language.

Therefore, in order to interoperate between languages, we should make our programs CLS-compliant.

Let's look at the hierarchy of the system, the system should be the assembly, the Assembly is the class (or structure, etc.). So in order to ensure the interoperability of the language, we should ensure that the external parts of the assembly are CLS-compliant.

This is an easy guarantee:

When we create a new assembly, there is a file called: AssemblyInfo.cs:

[assembly: AssemblyTitle("ClassLibrary1")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("微软中国")]
[assembly: AssemblyProduct("ClassLibrary1")]
[assembly: AssemblyCopyright("Copyright © 微软中国 2009")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 属性设置为 true。
[assembly: ComVisible(false)]

// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("694543e8-4c7f-4952-9e98-7282ecff1c15")]

// 程序集的版本信息由下面四个值组成:
//
//   主版本
//   次版本 
//   内部版本号
//   修订号
//
// 可以指定所有这些值,也可以使用“内部版本号”和“修订号” 的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.