DiscoveryClientDocumentCollection 类

定义

表示在 XML Web service 发现期间发现的、已下载到客户端的文档的集合。 此类不能被继承。

public ref class DiscoveryClientDocumentCollection sealed : System::Collections::DictionaryBase
public sealed class DiscoveryClientDocumentCollection : System.Collections.DictionaryBase
type DiscoveryClientDocumentCollection = class
    inherit DictionaryBase
Public NotInheritable Class DiscoveryClientDocumentCollection
Inherits DictionaryBase
继承
DiscoveryClientDocumentCollection

示例

下面的代码示例执行 XML Web 服务发现,并将发现的文档下载到客户端。 中 DiscoveryClientDocumentCollection 发现文档的名称将输出到控制台。

#using <System.dll>
#using <System.Web.Services.dll>

using namespace System;
using namespace System::Net;
using namespace System::IO;
using namespace System::Collections;
using namespace System::Web::Services::Discovery;

int main()
{
   DiscoveryClientProtocol^ myDiscoveryClientProtocol = gcnew DiscoveryClientProtocol;
   myDiscoveryClientProtocol->Credentials = CredentialCache::DefaultCredentials;
   
   // 'dataservice.disco' is a sample discovery document.
   String^ myStringUrl = "http://localhost/dataservice.disco";
   
   // 'Discover' method is called to populate the 'Documents' property.
   DiscoveryDocument^ myDiscoveryDocument =
      myDiscoveryClientProtocol->Discover( myStringUrl );
   
   // An instance of the 'DiscoveryClientDocumentCollection' class is created.
   DiscoveryClientDocumentCollection^ myDiscoveryClientDocumentCollection =
      myDiscoveryClientProtocol->Documents;
   
   // 'Keys' in the collection are retrieved.
   ICollection^ myCollection = myDiscoveryClientDocumentCollection->Keys;
   array<Object^>^myObjectCollection =
      gcnew array<Object^>(myDiscoveryClientDocumentCollection->Count);
   myCollection->CopyTo( myObjectCollection, 0 );
   Console::WriteLine( "The discovery documents in the collection are :" );
   for ( int iIndex = 0; iIndex < myObjectCollection->Length; iIndex++ )
   {
      Console::WriteLine( myObjectCollection[ iIndex ] );

   }
   Console::WriteLine( "" );
   
   // 'Values' in the collection are retrieved.
   ICollection^ myCollection1 = myDiscoveryClientDocumentCollection->Values;
   array<Object^>^myObjectCollection1 =
      gcnew array<Object^>(myDiscoveryClientDocumentCollection->Count);
   myCollection1->CopyTo( myObjectCollection1, 0 );
   Console::WriteLine( "The objects in the collection are :" );
   for ( int iIndex = 0; iIndex < myObjectCollection1->Length; iIndex++ )
   {
      Console::WriteLine( myObjectCollection1[ iIndex ] );

   }
}
using System;
using System.Net;
using System.IO;
using System.Collections;
using System.Security.Permissions;
using System.Web.Services.Discovery;

class DiscoveryClientDocumentCollectionSample
{
   static void Main()
   {
      Run();
   }

   [PermissionSetAttribute(SecurityAction.Demand, Name="FullTrust")]
   static void Run()
   {
      DiscoveryClientProtocol myDiscoveryClientProtocol =
         new DiscoveryClientProtocol();

      myDiscoveryClientProtocol.Credentials = CredentialCache.DefaultCredentials;

      // 'dataservice.disco' is a sample discovery document.
      string myStringUrl = "http://localhost/dataservice.disco";

      // 'Discover' method is called to populate the 'Documents' property.
      DiscoveryDocument myDiscoveryDocument =
         myDiscoveryClientProtocol.Discover(myStringUrl);

      // An instance of the 'DiscoveryClientDocumentCollection' class is created.
      DiscoveryClientDocumentCollection myDiscoveryClientDocumentCollection =
         myDiscoveryClientProtocol.Documents;

      // 'Keys' in the collection are retrieved.
      ICollection myCollection = myDiscoveryClientDocumentCollection.Keys;
      object[] myObjectCollection =
         new object[myDiscoveryClientDocumentCollection.Count];
      myCollection.CopyTo(myObjectCollection, 0);

      Console.WriteLine("The discovery documents in the collection are :");
      for (int iIndex=0; iIndex < myObjectCollection.Length; iIndex++)
      {
         Console.WriteLine(myObjectCollection[iIndex]);
      }

      Console.WriteLine("");

      // 'Values' in the collection are retrieved.
      ICollection myCollection1 = myDiscoveryClientDocumentCollection.Values;
      object[] myObjectCollection1 =
         new object[myDiscoveryClientDocumentCollection.Count];
      myCollection1.CopyTo(myObjectCollection1, 0);

      Console.WriteLine("The objects in the collection are :");
      for (int iIndex=0; iIndex < myObjectCollection1.Length; iIndex++)
      {
         Console.WriteLine(myObjectCollection1[iIndex]);
      }
   }
}
Imports System.Net
Imports System.IO
Imports System.Collections
Imports System.Security.Permissions
Imports System.Web.Services.Discovery

Class DiscoveryClientDocumentCollectionSample
   
   Shared Sub Main()
      Run()
   End Sub

   <PermissionSetAttribute(SecurityAction.Demand, Name := "FullTrust")> _
   Shared Sub Run()

      Dim myDiscoveryClientProtocol As New DiscoveryClientProtocol()
      
      myDiscoveryClientProtocol.Credentials = CredentialCache.DefaultCredentials
      
      ' 'dataservice.disco' is a sample discovery document.
      Dim myStringUrl As String = "http://localhost/dataservice.disco"
      
      ' 'Discover' method is called to populate the 'Documents' property.
      Dim myDiscoveryDocument As DiscoveryDocument = myDiscoveryClientProtocol.Discover(myStringUrl)
      
      ' An instance of the 'DiscoveryClientDocumentCollection' class is created.
      Dim myDiscoveryClientDocumentCollection As DiscoveryClientDocumentCollection = _
                                                myDiscoveryClientProtocol.Documents
      
      ' 'Keys' in the collection are retrieved.
      Dim myCollection As ICollection = myDiscoveryClientDocumentCollection.Keys
      Dim myObjectCollection(myDiscoveryClientDocumentCollection.Count-1) As Object
      myCollection.CopyTo(myObjectCollection, 0)
      
      Console.WriteLine("The discovery documents in the collection are :")
      Dim iIndex As Integer
      For iIndex = 0 To myObjectCollection.Length - 1
         Console.WriteLine(myObjectCollection(iIndex))
      Next iIndex
      
      Console.WriteLine("")
      
      ' 'Values' in the collection are retrieved.
      Dim myCollection1 As ICollection = myDiscoveryClientDocumentCollection.Values
      Dim myObjectCollection1(myDiscoveryClientDocumentCollection.Count-1) As Object
      myCollection1.CopyTo(myObjectCollection1, 0)
      
      Console.WriteLine("The objects in the collection are :")
      For iIndex = 0 To myObjectCollection1.Length - 1
         Console.WriteLine(myObjectCollection1(iIndex))
      Next iIndex
   End Sub
End Class

注解

DocumentsDiscoveryClientProtocol 属性的类型为 DiscoveryClientDocumentCollection

构造函数

DiscoveryClientDocumentCollection()

初始化 DiscoveryClientDocumentCollection 类的新实例。

属性

Count

获取 DictionaryBase 实例中包含的元素数。

(继承自 DictionaryBase)
Dictionary

获取 DictionaryBase 实例中包含的元素的列表。

(继承自 DictionaryBase)
InnerHashtable

获取 DictionaryBase 实例中包含的元素的列表。

(继承自 DictionaryBase)
Item[String]

从具有指定的 URL 的 DiscoveryClientDocumentCollection 获取或设置客户端发现文档对象。

Keys

获取一个 ICollection 对象,它具有 DiscoveryClientDocumentCollection 中的所有键。

Values

获取一个 ICollection 对象,它具有 DiscoveryClientDocumentCollection 中的所有值。

方法

Add(String, Object)

将一个具有指定 URL 的对象添加到 DiscoveryClientDocumentCollection

Clear()

清除 DictionaryBase 实例的内容。

(继承自 DictionaryBase)
Contains(String)

确定 DiscoveryClientDocumentCollection 是否包含具有指定 URL 的对象。

CopyTo(Array, Int32)

DictionaryBase 元素复制到位于指定索引处的一维 Array 中。

(继承自 DictionaryBase)
Equals(Object)

确定指定对象是否等于当前对象。

(继承自 Object)
GetEnumerator()

返回循环访问 IDictionaryEnumerator 实例的 DictionaryBase

(继承自 DictionaryBase)
GetHashCode()

作为默认哈希函数。

(继承自 Object)
GetType()

获取当前实例的 Type

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。

(继承自 Object)
OnClear()

在清除 DictionaryBase 实例的内容之前执行其他自定义进程。

(继承自 DictionaryBase)
OnClearComplete()

在清除 DictionaryBase 实例的内容之后执行其他自定义进程。

(继承自 DictionaryBase)
OnGet(Object, Object)

获取 DictionaryBase 实例中带有指定键和值的元素。

(继承自 DictionaryBase)
OnInsert(Object, Object)

在向 DictionaryBase 实例中插入新元素之前执行其他自定义进程。

(继承自 DictionaryBase)
OnInsertComplete(Object, Object)

在向 DictionaryBase 实例中插入新元素之后执行其他自定义进程。

(继承自 DictionaryBase)
OnRemove(Object, Object)

当从 DictionaryBase 实例移除元素时执行其他自定义进程。

(继承自 DictionaryBase)
OnRemoveComplete(Object, Object)

在从 DictionaryBase 实例中移除元素之后执行其他自定义进程。

(继承自 DictionaryBase)
OnSet(Object, Object, Object)

当在 DictionaryBase 实例中设置值之前执行其他自定义进程。

(继承自 DictionaryBase)
OnSetComplete(Object, Object, Object)

当在 DictionaryBase 实例中设置值后执行其他自定义进程。

(继承自 DictionaryBase)
OnValidate(Object, Object)

在验证具有指定键和值的元素时执行其他自定义进程。

(继承自 DictionaryBase)
Remove(String)

DiscoveryClientDocumentCollection 移除具有指定 URL 的对象。

ToString()

返回表示当前对象的字符串。

(继承自 Object)

显式接口实现

ICollection.IsSynchronized

获取一个值,该值指示对 DictionaryBase 对象的访问是否同步(线程安全)。

(继承自 DictionaryBase)
ICollection.SyncRoot

获取一个对象,该对象可用于同步对 DictionaryBase 对象的访问。

(继承自 DictionaryBase)
IDictionary.Add(Object, Object)

将带有指定键和值的元素添加到 DictionaryBase 中。

(继承自 DictionaryBase)
IDictionary.Contains(Object)

确定 DictionaryBase 是否包含特定键。

(继承自 DictionaryBase)
IDictionary.IsFixedSize

获取一个值,该值指示 DictionaryBase 对象是否具有固定大小。

(继承自 DictionaryBase)
IDictionary.IsReadOnly

获取一个值,该值指示 DictionaryBase 对象是否为只读。

(继承自 DictionaryBase)
IDictionary.Item[Object]

获取或设置与指定的键关联的值。

(继承自 DictionaryBase)
IDictionary.Keys

获取包含 ICollection 对象中的键的 DictionaryBase 对象。

(继承自 DictionaryBase)
IDictionary.Remove(Object)

DictionaryBase 中移除包含指定键的元素。

(继承自 DictionaryBase)
IDictionary.Values

获取 ICollection 对象,它包含 DictionaryBase 对象中的值。

(继承自 DictionaryBase)
IEnumerable.GetEnumerator()

返回循环访问 IEnumeratorDictionaryBase

(继承自 DictionaryBase)

扩展方法

Cast<TResult>(IEnumerable)

IEnumerable 的元素强制转换为指定的类型。

OfType<TResult>(IEnumerable)

根据指定类型筛选 IEnumerable 的元素。

AsParallel(IEnumerable)

启用查询的并行化。

AsQueryable(IEnumerable)

IEnumerable 转换为 IQueryable

适用于

另请参阅