DiscoveryClientDocumentCollection 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
表示在 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
- 继承
示例
下面的代码示例执行 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
注解
Documents的 DiscoveryClientProtocol 属性的类型为 DiscoveryClientDocumentCollection。
构造函数
DiscoveryClientDocumentCollection() |
初始化 DiscoveryClientDocumentCollection 类的新实例。 |
属性
Count |
获取 DictionaryBase 实例中包含的元素数。 (继承自 DictionaryBase) |
Dictionary |
获取 DictionaryBase 实例中包含的元素的列表。 (继承自 DictionaryBase) |
InnerHashtable |
获取 DictionaryBase 实例中包含的元素的列表。 (继承自 DictionaryBase) |
Item[String] |
从具有指定的 URL 的 DiscoveryClientDocumentCollection 获取或设置客户端发现文档对象。 |
Keys |
获取一个 ICollection 对象,它具有 DiscoveryClientDocumentCollection 中的所有键。 |
Values |
获取一个 ICollection 对象,它具有 DiscoveryClientDocumentCollection 中的所有值。 |
方法
显式接口实现
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。 |