SPServiceInstanceCollection Class
Represents a collection of SPServiceInstance objects.
Inheritance Hierarchy
System.Object
Microsoft.SharePoint.Administration.SPPersistedObjectCollection<SPServiceInstance>
Microsoft.SharePoint.Administration.SPPersistedChildCollection<SPServiceInstance>
Microsoft.SharePoint.Administration.SPServiceInstanceCollection
Namespace: Microsoft.SharePoint.Administration
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
<GuidAttribute("B089C872-3220-43C5-A503-833986C09275")> _
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
Public NotInheritable Class SPServiceInstanceCollection _
Inherits SPPersistedChildCollection(Of SPServiceInstance)
Dim instance As SPServiceInstanceCollection
[GuidAttribute("B089C872-3220-43C5-A503-833986C09275")]
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
public sealed class SPServiceInstanceCollection : SPPersistedChildCollection<SPServiceInstance>
Remarks
To return an SPServiceInstanceCollection object that represents the service instances that currently run on a server, use either the ServiceInstances property of the SPServer class, or the SPServiceInstanceCollection constructor. To return an SPServiceInstanceDependencyCollection object that represents the service instances that are dependent upon a service, use the Instances property of the SPService class.
To add a service instance to the collection, use the Add method.
Use an indexer to return a single service instance from the collection. For example, if the collection is assigned to a variable named myServiceInstances, use myServiceInstances[index] in C#, or myServiceInstances(index) in Visual Basic, where index is either the name or the GUID identifying the service instance.
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.