共用方式為


DiscoveryClientDocumentCollection 類別

定義

表示 XML Web 服務探索期間所探索且已下載至用戶端的文件集合。 此類別無法獲得繼承。

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()

傳回透過 IEnumerator 重複的 DictionaryBase

(繼承來源 DictionaryBase)

擴充方法

Cast<TResult>(IEnumerable)

IEnumerable 的項目轉換成指定的型別。

OfType<TResult>(IEnumerable)

根據指定的型別來篩選 IEnumerable 的項目。

AsParallel(IEnumerable)

啟用查詢的平行化作業。

AsQueryable(IEnumerable)

IEnumerable 轉換成 IQueryable

適用於

另請參閱