c# - 从代码 ⇒ IL 或 IL ⇒ native 代码创建的引用在哪里

标签 c# constructor reference

我正在努力寻找将为对象创建引用的位置以及将在哪个阶段创建它从程序到中间代码中间代码到 native 代码.

最佳答案

This article might help :

Typically, apps that target the .NET Framework are compiled to intermediate language (IL). At run time, the just-in-time (JIT) compiler translates the IL to native code. In contrast, .NET Native compiles Windows apps directly to native code.

因此,如您所见,IL 甚至不是先决条件,它可以完全省略(尽管在大多数情况下,它不应该)

As mentioned in the CLR guide :

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.

因此,由于执行的代码在运行之前被转换为 native 代码并创建了对象,所以我认为它回答了您的问题。

关于c# - 从代码 ⇒ IL 或 IL ⇒ native 代码创建的引用在哪里,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59763930/

相关文章:

c# - 在 Windows 上添加/删除设备时未收到蓝牙事件

c++ - 在 C++ 中不调用构造函数

Perl:对其他散列使用引用 has

reference - 可以实现返回引用或拥有值的特征方法

Java:对象指针处理

c# - 在 C# 中使用 LINQ 进行分页结果

c# - 从 C# 应用程序引用 visual basic 命名空间有什么影响?

c# - 同步两个 DataGridView 的水平滚动事件

c++ - 对象名称 C++

Scala 类成员和构造函数参数名称冲突