SPDiagnosticsServiceBase.Areas property
取得此SPDiagnosticsService物件中的所有區域的集合。
Namespace: Microsoft.SharePoint.Administration
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'宣告
Public ReadOnly Property Areas As SPDiagnosticsCollection(Of SPDiagnosticsArea)
Get
'用途
Dim instance As SPDiagnosticsServiceBase
Dim value As SPDiagnosticsCollection(Of SPDiagnosticsArea)
value = instance.Areas
public SPDiagnosticsCollection<SPDiagnosticsArea> Areas { get; }
Property value
Type: Microsoft.SharePoint.Administration.SPDiagnosticsCollection<SPDiagnosticsArea>
區域集合。
Examples
下列範例會列舉登錄於本機伺服器陣列,診斷服務的 [診斷] 區域的簡單主控台應用程式,並且也列舉診斷類別的每個區域。
using System;
using Microsoft.SharePoint.Administration;
namespace ConsoleApp
{
class Program
{
static void Main(string[] args)
{
SPDiagnosticsService diagnosticsService = SPDiagnosticsService.Local;
foreach (SPDiagnosticsArea area in diagnosticsService.Areas)
{
Console.WriteLine("\nArea: {0}", area.Name);
foreach (SPDiagnosticsCategory category in area.Categories)
{
Console.WriteLine("Category: {0}", category.Name);
}
}
Console.Write("\nPress ENTER to continue...");
Console.ReadLine();
}
}
}
請參閱
參照
SPDiagnosticsServiceBase class