简体   繁体   English

C#是否可以在代码中设置GC模式?

[英]C# Is it possible to set the GC mode in code?

I want to use server background GC for an application and i want to enable this from code. 我想为应用程序使用服务器后台GC,并且想从代码中启用它。 So is it possible to set the equivalent of 所以可以设置等价于

<configuration>
  <runtime>
    <gcServer enabled=”true”/>
  </runtime>
</configuration>

from app.config, in code? 从app.config,在代码中?

This has to happen before the application (and to some extent, the CLR) is loaded. 这必须在加载应用程序(在某种程度上为CLR)之前发生。 Unless you're making your own CLR host, by the time your application actually runs it's too late to change it. 除非您要制作自己的CLR主机,否则在您的应用程序实际运行时,更改它为时已晚。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM