ServiceDescriptionCollection 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
表示 ServiceDescription 類別的執行個體的集合。 此類別無法獲得繼承。
public ref class ServiceDescriptionCollection sealed : System::Web::Services::Description::ServiceDescriptionBaseCollection
public sealed class ServiceDescriptionCollection : System.Web.Services.Description.ServiceDescriptionBaseCollection
type ServiceDescriptionCollection = class
inherit ServiceDescriptionBaseCollection
Public NotInheritable Class ServiceDescriptionCollection
Inherits ServiceDescriptionBaseCollection
- 繼承
範例
#using <System.Web.Services.dll>
#using <System.Xml.dll>
using namespace System;
using namespace System::Xml;
using namespace System::Web::Services::Description;
int main()
{
try
{
// Get ServiceDescription objects.
ServiceDescription^ myServiceDescription1 = ServiceDescription::Read( "DataTypes_cpp.wsdl" );
ServiceDescription^ myServiceDescription2 = ServiceDescription::Read( "MathService_cpp.wsdl" );
// Set the names of the ServiceDescriptions.
myServiceDescription1->Name = "DataTypes";
myServiceDescription2->Name = "MathService";
// Create a ServiceDescriptionCollection.
ServiceDescriptionCollection^ myServiceDescriptionCollection = gcnew ServiceDescriptionCollection;
// Add the ServiceDescriptions to the collection.
myServiceDescriptionCollection->Add( myServiceDescription1 );
myServiceDescriptionCollection->Add( myServiceDescription2 );
// Display the elements of the collection using the Item property.
Console::WriteLine( "Elements in the collection: " );
for ( int i = 0; i < myServiceDescriptionCollection->Count; i++ )
Console::WriteLine( myServiceDescriptionCollection[ i ]->Name );
// Construct an XML qualified name.
XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "MathServiceSoap","http://tempuri2.org/" );
// Get the Binding from the collection.
Binding^ myBinding = myServiceDescriptionCollection->GetBinding( myXmlQualifiedName );
Console::WriteLine( "Binding found in collection with name: {0}", myBinding->ServiceDescription->Name );
}
catch ( Exception^ e )
{
Console::WriteLine( "The following exception was raised: {0}", e->Message );
}
}
using System;
using System.Xml;
using System.Web.Services.Description;
class MyServiceDescriptionCollection
{
public static void Main()
{
try
{
// Get ServiceDescription objects.
ServiceDescription myServiceDescription1 =
ServiceDescription.Read("DataTypes_CS.wsdl");
ServiceDescription myServiceDescription2 =
ServiceDescription.Read("MathService_CS.wsdl");
// Set the names of the ServiceDescriptions.
myServiceDescription1.Name = "DataTypes";
myServiceDescription2.Name = "MathService";
// Create a ServiceDescriptionCollection.
ServiceDescriptionCollection myServiceDescriptionCollection =
new ServiceDescriptionCollection();
// Add the ServiceDescriptions to the collection.
myServiceDescriptionCollection.Add(myServiceDescription1);
myServiceDescriptionCollection.Add(myServiceDescription2);
// Display the elements of the collection using the indexer.
Console.WriteLine("Elements in the collection: ");
for(int i = 0; i < myServiceDescriptionCollection.Count; i++)
{
Console.WriteLine(myServiceDescriptionCollection[i].Name);
}
// Construct an XML qualified name.
XmlQualifiedName myXmlQualifiedName =
new XmlQualifiedName("MathServiceSoap", "http://tempuri2.org/");
// Get the Binding from the collection.
Binding myBinding =
myServiceDescriptionCollection.GetBinding(myXmlQualifiedName);
Console.WriteLine("Binding found in collection with name: " +
myBinding.ServiceDescription.Name);
}
catch(Exception e)
{
Console.WriteLine("The following exception was raised: {0}", e.Message);
}
}
}
Imports System.Xml
Imports System.Web.Services.Description
Class MyServiceDescriptionCollection
Public Shared Sub Main()
Try
' Get ServiceDescription objects.
Dim myServiceDescription1 As ServiceDescription = _
ServiceDescription.Read("DataTypes_VB.wsdl")
Dim myServiceDescription2 As ServiceDescription = _
ServiceDescription.Read("MathService_VB.wsdl")
' Set the names of the ServiceDescriptions.
myServiceDescription1.Name = "DataTypes"
myServiceDescription2.Name = "MathService"
' Create a ServiceDescriptionCollection.
Dim myServiceDescriptionCollection As _
New ServiceDescriptionCollection()
' Add the ServiceDescriptions to the collection.
myServiceDescriptionCollection.Add(myServiceDescription1)
myServiceDescriptionCollection.Add(myServiceDescription2)
' Display the elements of the collection using the Item property.
Console.WriteLine("Elements in the collection: ")
Dim i As Integer
For i = 0 To myServiceDescriptionCollection.Count - 1
Console.WriteLine(myServiceDescriptionCollection(i).Name)
Next i
' Construct an XML qualified name.
Dim myXmlQualifiedName As New XmlQualifiedName( _
"MathServiceSoap", "http://tempuri2.org/")
' Get the Binding from the collection.
Dim myBinding As Binding = _
myServiceDescriptionCollection.GetBinding(myXmlQualifiedName)
Console.WriteLine("Binding found in collection with name: " & _
myBinding.ServiceDescription.Name)
Catch e As Exception
Console.WriteLine("The following exception was raised: {0}", _
e.Message.ToString())
End Try
End Sub
End Class
建構函式
ServiceDescriptionCollection() |
初始化 ServiceDescriptionCollection 類別的新執行個體。 |
屬性
Capacity |
取得或設定 CollectionBase 可包含的項目數目。 (繼承來源 CollectionBase) |
Count |
取得 CollectionBase 執行個體中包含的元素數目。 這個屬性無法覆寫。 (繼承來源 CollectionBase) |
InnerList |
取得包含 ArrayList 執行個體中之元素清單的 CollectionBase。 (繼承來源 CollectionBase) |
Item[Int32] |
取得或設定 ServiceDescription 的值,於指定的以零起始的索引位置。 |
Item[String] |
取得其 ServiceDescription 屬性所指定的 TargetNamespace。 |
List |
取得包含 IList 執行個體中之元素清單的 CollectionBase。 (繼承來源 CollectionBase) |
Table |
取得實作 ServiceDescriptionBaseCollection 中索引鍵和數值關聯的介面。 (繼承來源 ServiceDescriptionBaseCollection) |
方法
明確介面實作
ICollection.CopyTo(Array, Int32) |
從目標陣列的指定索引開始,將整個 CollectionBase 複製到相容的一維 Array。 (繼承來源 CollectionBase) |
ICollection.IsSynchronized |
取得值,這個值表示對 CollectionBase 的存取是否同步 (安全執行緒)。 (繼承來源 CollectionBase) |
ICollection.SyncRoot |
取得可用以同步存取 CollectionBase 的物件。 (繼承來源 CollectionBase) |
IList.Add(Object) |
將物件加入至 CollectionBase 的末端。 (繼承來源 CollectionBase) |
IList.Contains(Object) |
判斷 CollectionBase 是否包含特定項目。 (繼承來源 CollectionBase) |
IList.IndexOf(Object) |
搜尋指定的 Object,並傳回在整個 CollectionBase 中第一個符合項目之以零為起始的索引。 (繼承來源 CollectionBase) |
IList.Insert(Int32, Object) |
將項目插入至 CollectionBase 中指定的索引位置。 (繼承來源 CollectionBase) |
IList.IsFixedSize |
取得值,指出 CollectionBase 是否有固定的大小。 (繼承來源 CollectionBase) |
IList.IsReadOnly |
取得值,指出 CollectionBase 是否唯讀。 (繼承來源 CollectionBase) |
IList.Item[Int32] |
在指定的索引位置上取得或設定項目。 (繼承來源 CollectionBase) |
IList.Remove(Object) |
從 CollectionBase 移除特定物件之第一個符合的元素。 (繼承來源 CollectionBase) |
擴充方法
Cast<TResult>(IEnumerable) |
將 IEnumerable 的項目轉換成指定的型別。 |
OfType<TResult>(IEnumerable) |
根據指定的型別來篩選 IEnumerable 的項目。 |
AsParallel(IEnumerable) |
啟用查詢的平行化作業。 |
AsQueryable(IEnumerable) |
將 IEnumerable 轉換成 IQueryable。 |