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。 |