共用方式為


SPServerCollection Class

Represents a collection of SPServer objects.

Inheritance Hierarchy

System.Object
  Microsoft.SharePoint.Administration.SPPersistedObjectCollection<SPServer>
    Microsoft.SharePoint.Administration.SPPersistedChildCollection<SPServer>
      Microsoft.SharePoint.Administration.SPServerCollection

Namespace:  Microsoft.SharePoint.Administration
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
Public NotInheritable Class SPServerCollection _
    Inherits SPPersistedChildCollection(Of SPServer)

Dim instance As SPServerCollection
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
public sealed class SPServerCollection : SPPersistedChildCollection<SPServer>

Remarks

Use either the Servers property of the SPFarm class, or the SPServerCollection constructor, to get the collection of servers that is used in the specified server farm.

Use an indexer to return a single server from the collection. For example, if the collection is assigned to a variable named myServers, use myServers[index] in C#, or myServers(index) in Visual Basic, where index is either the GUID or the name that identifies the service.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

SPServerCollection Members

Microsoft.SharePoint.Administration Namespace