DiscoveryClientReferenceCollection.Keys 属性

定义

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

public System.Collections.ICollection Keys { get; }

属性值

一个 ICollection,包含 DiscoveryClientReferenceCollection 的键。

示例

DiscoveryClientProtocol myDiscoveryClientProtocol =
    new DiscoveryClientProtocol();
myDiscoveryClientProtocol.Credentials =
    CredentialCache.DefaultCredentials;

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

// Call the Discover method to populate the References property.
DiscoveryDocument myDiscoveryDocument =
    myDiscoveryClientProtocol.Discover(myStringUrl);

// Resolve all references found in the discovery document.
myDiscoveryClientProtocol.ResolveAll();
DiscoveryClientReferenceCollection myDiscoveryClientReferenceCollection =
    myDiscoveryClientProtocol.References;

// Retrieve the keys in the collection.
ICollection myCollection = myDiscoveryClientReferenceCollection.Keys;
object[] myObjectCollection =
    new object[myDiscoveryClientReferenceCollection.Count];
myCollection.CopyTo(myObjectCollection, 0);
Console.WriteLine("The discovery documents, service descriptions, and XML schema");
Console.WriteLine(" definitions in the collection are:");
for (int iIndex=0; iIndex < myObjectCollection.Length; iIndex++)
{
    Console.WriteLine(myObjectCollection[iIndex]);
}

适用于

产品 版本
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1