Compartilhar via


Common Language Runtime (CLR)

The .NET Framework provides a run-time environment called the common language runtime, which runs the code and provides services that make the development process easier.

Compiladores e ferramentas expõem as funcionalidades do Common Language Runtimee permitem que você escreva código que aproveitam essa de execução ambiente gerenciado . Code that you develop with a language compiler that targets the runtime is called managed code; it benefits from features such as cross-language integration, cross-language exception handling, enhanced security, versioning and deployment support, a simplified model for component interaction, and debugging and profiling services.

To enable the runtime to provide services to managed code, language compilers must emit metadata that describes the types, members, and references in your code. Metadata is stored with the code; every loadable common language runtime portable executable (PE) file contains metadata. The runtime uses metadata to locate and load classes, lay out instances in memory, resolve method invocations, generate native code, enforce security, and set run-time context boundaries.

The runtime automatically handles object layout and manages references to objects, releasing them when they are no longer being used. Objects whose lifetimes are managed in this way are called managed data. Garbage collection eliminates memory leaks as well as some other common programming errors. If your code is managed, you can use managed data, unmanaged data, or both managed and unmanaged data in your .NET Framework application. Because language compilers supply their own types, such as primitive types, you might not always know (or need to know) whether your data is being managed.

The common language runtime makes it easy to design components and applications whose objects interact across languages. Objects written in different languages can communicate with each other, and their behaviors can be tightly integrated. For example, you can define a class and then use a different language to derive a class from your original class or call a method on the original class. You can also pass an instance of a class to a method of a class written in a different language. This cross-language integration is possible because language compilers and tools that target the runtime use a common type system defined by the runtime, and they follow the runtime's rules for defining new types, as well as for creating, using, persisting, and binding to types.

As part of their metadata, all managed components carry information about the components and resources they were built against. The runtime uses this information to ensure that your component or application has the specified versions of everything it needs, which makes your code less likely to break because of some unmet dependency. Registration information and state data are no longer stored in the registry where they can be difficult to establish and maintain. Em vez disso, informações sobre os tipos que você definir (e suas dependências) são armazenadas com o código, como metadados, fazendo com que as tarefas de replicação de componente e remoção muito menos complicado.

Language compilers and tools expose the runtime's functionality in ways that are intended to be useful and intuitive to developers. This means that some features of the runtime might be more noticeable in one environment than in another. How you experience the runtime depends on which language compilers or tools you use. For example, if you are a Visual Basic developer, you might notice that with the common language runtime, the Visual Basic language has more object-oriented features than before. O tempo de execução fornece os seguintes benefícios:

  • Performance improvements.

  • The ability to easily use components developed in other languages.

  • Extensible types provided by a class library.

  • Recursos de linguagem como herança, interfaces e sobrecarga para o objeto-oriented programming.

  • Suporte de segmentação livre explícita que permite a criação de aplicativos de vários segmentos, escalonáveis.

  • Suporte para manipulação estruturada de exceção .

  • Suporte para atributos personalizados.

  • Garbage collection.

  • Utilização de delegados em vez de ponteiros de função para aumento segurança de tipos and segurança. Para obter mais informações sobre delegados, consulte Common Type System.

Title

Description

Processo de Execução Gerenciada

Describes the steps required to take advantage of the common language runtime.

Gerenciamento automático de memória

Describes how the garbage collector allocates and releases memory.

Visão geral sobre o .NET Framework

Descreve a chave .NET Framework de conceitos como, por exemplo, o common type system, entre a interoperabilidade de linguagem-, execução gerenciado , domínios de aplicativo e assemblies.

Visão geral de hospedagem.

Describes runtime hosts, which are sections of code that load the runtime into a process, create the application domains within the process, and load and run user code within those application domains.

Common Type System

Descreve como tipos são declarados, usados e gerenciado no tempo de execução para oferecer suporte entre a integração de linguagens de-.