C# cannot be used in isolation and must be used together with the .NET Framework.
(1)C#’s architecture and methodology reflect the .NET basic methodology.
(2) In most cases, C#'s specific language features depend on .NET features, or rely on .NET base classes.
Some features supported by .NET are not supported by C#. There are other features supported by the C# language that are not supported by .NET.
The core of the .NET Framework is its runtime environment, called the common language runtime (CLR) or .NET runtime.
Code that runs under the control of the CLR is usually called managed code.
How .NET compiles code:
Stage 1: Compile the source code into Microsoft Intermediate Language (IL).
*IL is similar to the bytecode in JAVA.
Stage 2: The CLR compiles IL into platform-specific code.
The JIT (just-in-time compiler) compiles the application when it is running, so the JIL knows exactly Depending on what type of processor the program runs on, it can be optimized for that processor to improve performance.
Visual Basic 2013, Visual C++ 2013, Visual F#, COM and COM+, Windows runtime library.
The main features of the intermediate language:
IL generally does not allow any operations on ambiguous data types, although forcing type safety seems to reduce performance, but in most cases Below we get more benefits from the services provided by .NET that rely on type safety. These services include:
Language interoperability
Value type (value type), variables store their data directly, intermediate language is stored on the stack (if declared as fields in a reference type, they are stored inline pile).
Reference type (reference type), variables only store addresses, and instances of reference types are always stored in a memory area called the "managed heap".
Forced typing
The true meaning of language interoperability Using a language Classes should be written to communicate directly with classes written in another language. Such a tool is provided (by the Visual Studio IDE) (not the CLR).
Object-orientedand using interface
Value types and Significant differences between reference types.
The importance of strong data typing in language interoperability
If a class derives from or contains instances of other classes, it needs to know all the data types used by other classes, which is why language interoperability is very important.
Solutions in .NET
CTS also allows you to define your own types of code.
The hierarchical structure of CTS reflects the singleness of the intermediate language
inherits the object-oriented approach of .
Security
Application Domain
The garbage collector is used for memory management in .NET, especially It can restore the memory needed by running applications.
# Check the managed heap for unreferenced objects and delete them.
Use exceptions to handle errors
Use attributes
The above is the detailed content of C# Advanced Programming (1)-.NET Architecture. For more information, please follow other related articles on the PHP Chinese website!