This documentation is archived and is not being maintained.

ServiceDescriptionCollection.GetService Method

Searches the ServiceDescriptionCollection and returns the Service with the specified name that is a member of one of the ServiceDescription instances contained in the collection.

[Visual Basic]
Public Function GetService( _
   ByVal name As XmlQualifiedName _
) As Service
[C#]
public Service GetService(
 XmlQualifiedName name
);
[C++]
public: Service* GetService(
 XmlQualifiedName* name
);
[JScript]
public function GetService(
   name : XmlQualifiedName
) : Service;

Parameters

name
The XmlQualifiedName, passed by reference, whose Name property is shared by the Service returned.

Return Value

A Service.

Exceptions

Exception Type Condition
Exception The specified Service is not a member of any ServiceDescription instances within the collection.

Example

[Visual Basic] 
' Construct an XML qualified name.
Dim myXmlQualifiedName As _
   New XmlQualifiedName("MathService", "http://tempuri2.org/")

' Get the Service from the collection.
Dim myService As Service = myCollection.GetService(myXmlQualifiedName)

[C#] 
// Construct an XML qualified name.
XmlQualifiedName myXmlQualifiedName = 
   new XmlQualifiedName("MathService", "http://tempuri2.org/");

// Get the Service from the collection.
Service myService = myCollection.GetService(myXmlQualifiedName);

[C++] 
// Construct an XML qualified name.
XmlQualifiedName* myXmlQualifiedName = 
   new XmlQualifiedName(S"MathService", S"http://tempuri2.org/");\

// Get the Service from the collection.
myCollection->GetService(myXmlQualifiedName);

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

ServiceDescriptionCollection Class | ServiceDescriptionCollection Members | System.Web.Services.Description Namespace

Show: