GCSettings.IsServerGC 属性  
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取一个值,该值指示是否启用了服务器垃圾回收。
public:
 static property bool IsServerGC { bool get(); };public static bool IsServerGC { get; }member this.IsServerGC : boolPublic Shared ReadOnly Property IsServerGC As Boolean属性值
如果启用了服务器垃圾回收,则为 true;否则为 false。
示例
以下示例指示主计算机是使用服务器还是工作站垃圾回收。
using System;
using System.Runtime;
class Sample
{
    public static void Main()
    {
        string result;
        if (GCSettings.IsServerGC == true)
            result = "server";
        else
            result = "workstation";
        Console.WriteLine("The {0} garbage collector is running.", result);
    }
}
// The example displays output like the following:
//      The workstation garbage collector is running.
Imports System.Runtime
Class Sample
   Public Shared Sub Main()
      Dim result As String
      
      If GCSettings.IsServerGC = True Then
         result = "server"
      Else
         result = "workstation"
      End If
      Console.WriteLine("The {0} garbage collector is running.", result)
   End Sub
End Class 
' The example displays output like the following:
'      The workstation garbage collector is running.
注解
有关服务器垃圾回收的信息,请参阅 工作站和服务器垃圾回收。
如果未启用服务器垃圾回收,则工作站垃圾回收实际上 (与或不使用并发回收) 。 服务器垃圾回收仅在多处理器计算机上可用。
非托管主机可以请求服务器垃圾回收,主机请求将替代配置文件设置。 如果主机未指定垃圾回收的类型,可以使用配置设置来指定服务器垃圾回收。 有关详细信息,请参阅 配置工作站与服务器。