DiscoveryClientDocumentCollection 类
定义
表示在 XML Web service 发现期间发现的、已下载到客户端的文档的集合。Represents a collection of documents discovered during XML Web services discovery that have been downloaded to the client. 此类不能被继承。This class cannot be inherited.
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
- 继承
示例
下面的代码示例制定 XML Web service 发现并将发现的文档下载到客户端。The following code example enacts XML Web service discovery and downloads the discovered documents to the client. 中发现文档的名称 DiscoveryClientDocumentCollection 将输出到控制台。The names of the discovery documents within the DiscoveryClientDocumentCollection are output to the console.
#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
注解
的 Documents 属性 DiscoveryClientProtocol 的类型为 DiscoveryClientDocumentCollection 。The Documents property of DiscoveryClientProtocol is of type DiscoveryClientDocumentCollection.
构造函数
| DiscoveryClientDocumentCollection() |
初始化 DiscoveryClientDocumentCollection 类的新实例。Initializes a new instance of the DiscoveryClientDocumentCollection class. |
属性
| Count |
获取 DictionaryBase 实例中包含的元素数。Gets the number of elements contained in the DictionaryBase instance. (继承自 DictionaryBase) |
| Dictionary |
获取 DictionaryBase 实例中包含的元素的列表。Gets the list of elements contained in the DictionaryBase instance. (继承自 DictionaryBase) |
| InnerHashtable |
获取 DictionaryBase 实例中包含的元素的列表。Gets the list of elements contained in the DictionaryBase instance. (继承自 DictionaryBase) |
| Item[String] |
从具有指定的 URL 的 DiscoveryClientDocumentCollection 获取或设置客户端发现文档对象。Gets or sets a client discovery document object from the DiscoveryClientDocumentCollection with the specified URL. |
| Keys |
获取一个 ICollection 对象,它具有 DiscoveryClientDocumentCollection 中的所有键。Gets an ICollection object with all the keys in the DiscoveryClientDocumentCollection. |
| Values |
获取一个 ICollection 对象,它具有 DiscoveryClientDocumentCollection 中的所有值。Gets an ICollection object with all the values in the DiscoveryClientDocumentCollection. |
方法
| Add(String, Object) |
将一个具有指定 URL 的对象添加到 DiscoveryClientDocumentCollection。Adds an object with the specified URL to the DiscoveryClientDocumentCollection. |
| Clear() |
清除 DictionaryBase 实例的内容。Clears the contents of the DictionaryBase instance. (继承自 DictionaryBase) |
| Contains(String) |
确定 DiscoveryClientDocumentCollection 是否包含具有指定 URL 的对象。Determines if the DiscoveryClientDocumentCollection contains an object with the specified URL. |
| CopyTo(Array, Int32) |
将 DictionaryBase 元素复制到位于指定索引处的一维 Array 中。Copies the DictionaryBase elements to a one-dimensional Array at the specified index. (继承自 DictionaryBase) |
| Equals(Object) |
确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object. (继承自 Object) |
| GetEnumerator() |
返回循环访问 IDictionaryEnumerator 实例的 DictionaryBase。Returns an IDictionaryEnumerator that iterates through the DictionaryBase instance. (继承自 DictionaryBase) |
| GetHashCode() |
作为默认哈希函数。Serves as the default hash function. (继承自 Object) |
| GetType() |
获取当前实例的 Type。Gets the Type of the current instance. (继承自 Object) |
| MemberwiseClone() |
创建当前 Object 的浅表副本。Creates a shallow copy of the current Object. (继承自 Object) |
| OnClear() |
在清除 DictionaryBase 实例的内容之前执行其他自定义进程。Performs additional custom processes before clearing the contents of the DictionaryBase instance. (继承自 DictionaryBase) |
| OnClearComplete() |
在清除 DictionaryBase 实例的内容之后执行其他自定义进程。Performs additional custom processes after clearing the contents of the DictionaryBase instance. (继承自 DictionaryBase) |
| OnGet(Object, Object) |
获取 DictionaryBase 实例中带有指定键和值的元素。Gets the element with the specified key and value in the DictionaryBase instance. (继承自 DictionaryBase) |
| OnInsert(Object, Object) |
在向 DictionaryBase 实例中插入新元素之前执行其他自定义进程。Performs additional custom processes before inserting a new element into the DictionaryBase instance. (继承自 DictionaryBase) |
| OnInsertComplete(Object, Object) |
在向 DictionaryBase 实例中插入新元素之后执行其他自定义进程。Performs additional custom processes after inserting a new element into the DictionaryBase instance. (继承自 DictionaryBase) |
| OnRemove(Object, Object) |
当从 DictionaryBase 实例移除元素时执行其他自定义进程。Performs additional custom processes before removing an element from the DictionaryBase instance. (继承自 DictionaryBase) |
| OnRemoveComplete(Object, Object) |
在从 DictionaryBase 实例中移除元素之后执行其他自定义进程。Performs additional custom processes after removing an element from the DictionaryBase instance. (继承自 DictionaryBase) |
| OnSet(Object, Object, Object) |
当在 DictionaryBase 实例中设置值之前执行其他自定义进程。Performs additional custom processes before setting a value in the DictionaryBase instance. (继承自 DictionaryBase) |
| OnSetComplete(Object, Object, Object) |
当在 DictionaryBase 实例中设置值后执行其他自定义进程。Performs additional custom processes after setting a value in the DictionaryBase instance. (继承自 DictionaryBase) |
| OnValidate(Object, Object) |
在验证具有指定键和值的元素时执行其他自定义进程。Performs additional custom processes when validating the element with the specified key and value. (继承自 DictionaryBase) |
| Remove(String) |
从 DiscoveryClientDocumentCollection 移除具有指定 URL 的对象。Removes an object with the specified URL from the DiscoveryClientDocumentCollection. |
| ToString() |
返回表示当前对象的字符串。Returns a string that represents the current object. (继承自 Object) |
显式接口实现
| ICollection.IsSynchronized |
获取一个值,该值指示对 DictionaryBase 对象的访问是否同步(线程安全)。Gets a value indicating whether access to a DictionaryBase object is synchronized (thread safe). (继承自 DictionaryBase) |
| ICollection.SyncRoot |
获取一个对象,该对象可用于同步对 DictionaryBase 对象的访问。Gets an object that can be used to synchronize access to a DictionaryBase object. (继承自 DictionaryBase) |
| IDictionary.Add(Object, Object) |
将带有指定键和值的元素添加到 DictionaryBase 中。Adds an element with the specified key and value into the DictionaryBase. (继承自 DictionaryBase) |
| IDictionary.Contains(Object) |
确定 DictionaryBase 是否包含特定键。Determines whether the DictionaryBase contains a specific key. (继承自 DictionaryBase) |
| IDictionary.IsFixedSize |
获取一个值,该值指示 DictionaryBase 对象是否具有固定大小。Gets a value indicating whether a DictionaryBase object has a fixed size. (继承自 DictionaryBase) |
| IDictionary.IsReadOnly |
获取一个值,该值指示 DictionaryBase 对象是否为只读。Gets a value indicating whether a DictionaryBase object is read-only. (继承自 DictionaryBase) |
| IDictionary.Item[Object] |
获取或设置与指定的键关联的值。Gets or sets the value associated with the specified key. (继承自 DictionaryBase) |
| IDictionary.Keys |
获取包含 ICollection 对象中的键的 DictionaryBase 对象。Gets an ICollection object containing the keys in the DictionaryBase object. (继承自 DictionaryBase) |
| IDictionary.Remove(Object) |
从 DictionaryBase 中移除带有指定键的元素。Removes the element with the specified key from the DictionaryBase. (继承自 DictionaryBase) |
| IDictionary.Values |
获取 ICollection 对象,它包含 DictionaryBase 对象中的值。Gets an ICollection object containing the values in the DictionaryBase object. (继承自 DictionaryBase) |
| IEnumerable.GetEnumerator() |
返回循环访问 IEnumerator 的 DictionaryBase。Returns an IEnumerator that iterates through the DictionaryBase. (继承自 DictionaryBase) |
扩展方法
| Cast<TResult>(IEnumerable) |
将 IEnumerable 的元素强制转换为指定的类型。Casts the elements of an IEnumerable to the specified type. |
| OfType<TResult>(IEnumerable) |
根据指定类型筛选 IEnumerable 的元素。Filters the elements of an IEnumerable based on a specified type. |
| AsParallel(IEnumerable) |
启用查询的并行化。Enables parallelization of a query. |
| AsQueryable(IEnumerable) |
将 IEnumerable 转换为 IQueryable。Converts an IEnumerable to an IQueryable. |