This documentation is archived and is not being maintained.

DiscoveryClientReferenceCollection Class

Represents a collection of DiscoveryReference objects. This class cannot be inherited.

Namespace: System.Web.Services.Discovery
Assembly: System.Web.Services (in

public sealed class DiscoveryClientReferenceCollection : DictionaryBase
public final class DiscoveryClientReferenceCollection extends DictionaryBase
public final class DiscoveryClientReferenceCollection extends DictionaryBase
Not applicable.

The References property of DiscoveryClientProtocol is of type DiscoveryClientReferenceCollection.

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

class MyDiscoveryClientReferenceCollection
   static void Main()

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

      // 'dataservice.vsdisco' is a sample discovery document.
      string myStringUrl = "http://localhost/dataservice.vsdisco";
      // Call the Discover method to populate the References property.
      DiscoveryDocument myDiscoveryDocument = 

      // Resolve all references found in the discovery document.
      DiscoveryClientReferenceCollection myDiscoveryClientReferenceCollection = 
      // Retrieve the keys from 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 i=0; i< myObjectCollection.Length; i++)

      // Retrieve the values from the collection.
      ICollection myCollection1 = myDiscoveryClientReferenceCollection.Values;
      object[] myObjectCollection1 = 
          new object[myDiscoveryClientReferenceCollection.Count];
      myCollection1.CopyTo(myObjectCollection1, 0);
      Console.WriteLine("The objects in the collection are: ");
      for (int i=0; i< myObjectCollection1.Length; i++)


      string myStringUrl1 = "http://localhost/dataservice.vsdisco";
      if (myDiscoveryClientReferenceCollection.Contains(myStringUrl1))
         Console.WriteLine("The document reference {0} is part of the collection.",


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0