SPServiceInstanceCollection Class
Represents a collection of SPServiceInstance objects.
Microsoft.SharePoint.Administration.SPPersistedObjectCollection<SPServiceInstance>
Microsoft.SharePoint.Administration.SPPersistedChildCollection<SPServiceInstance>
Microsoft.SharePoint.Administration.SPServiceInstanceCollection
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No
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.