What determines the .Net version used for Garbage Collection?
In .Net 4 there is improved Garbage Collection which is important for our systems.
If I have a .Net 4 Winforms project that references .Net 2/.Net3.5 class libraries what version of .Net is used for Garbage Collection?
I am keen to get the .Net 4 GC working and so if the project files (*.csproj) files have to开发者_JAVA技巧 be changed to use .Net 4 for the .Net 4 GC to kick in, so be it.
Thanks
The GC used will be the CLR running. If you are using .net 4 CLR for your executable then the 2.0 objects will run in the 4.0 CLR, unless they run out of process.
If you have an .exe that is built for CLR2 then it will still use CLR2 by default. To force a .net 2.0 CLR exe to run on the CLR 4.0 use the following in the config file.
<configuration>
<startup>
<supportedRuntime version="v4.0"/>
</startup>
</configuration>
精彩评论