次の方法で共有


DiscoveryClientReferenceCollection クラス

DiscoveryReference オブジェクトのコレクションを表します。このクラスは継承できません。

この型のすべてのメンバの一覧については、DiscoveryClientReferenceCollection メンバ を参照してください。

System.Object
   System.Collections.DictionaryBase
      System.Web.Services.Discovery.DiscoveryClientReferenceCollection

NotInheritable Public Class DiscoveryClientReferenceCollection
   Inherits DictionaryBase
[C#]
public sealed class DiscoveryClientReferenceCollection :
   DictionaryBase
[C++]
public __gc __sealed class DiscoveryClientReferenceCollection :
   public DictionaryBase
[JScript]
public class DiscoveryClientReferenceCollection extends
   DictionaryBase

スレッドセーフ

この型の public static (Visual Basicでは Shared) のすべてのメンバは、マルチスレッド操作で安全に使用できます。インスタンスのメンバの場合は、スレッドセーフであるとは限りません。

解説

DiscoveryClientProtocolReferences プロパティが DiscoveryClientReferenceCollection 型です。

使用例

 
Imports System
Imports System.Net
Imports System.Collections
Imports System.Web.Services.Discovery

Public Class MyDiscoveryClientReferenceCollection
   
   Public Shared Sub Main()
      Dim myDiscoveryClientProtocol As New DiscoveryClientProtocol()
      
      myDiscoveryClientProtocol.Credentials = CredentialCache.DefaultCredentials
      
      ' 'dataservice.vsdisco' is a sample discovery document.
      Dim myStringUrl As String = "https://localhost/dataservice.vsdisco"
      
      ' Call the Discover method to populate the References property.
      Dim myDiscoveryDocument As DiscoveryDocument = _
          myDiscoveryClientProtocol.Discover(myStringUrl)
      
      ' Resolve all references found in the discovery document.
      myDiscoveryClientProtocol.ResolveAll()
      
      Dim myDiscoveryClientReferenceCollection As DiscoveryClientReferenceCollection = _ 
          myDiscoveryClientProtocol.References

      ' Retrieve the keys from the collection.
      Dim myCollection As ICollection = myDiscoveryClientReferenceCollection.Keys
      Dim myObjectCollection(myDiscoveryClientReferenceCollection.Count) As Object
      myCollection.CopyTo(myObjectCollection, 0)

      Console.WriteLine("The discovery documents, service descriptions, and XML schema")
      Console.WriteLine(" definitions in the collection are:")
      Dim i As Integer
      For i = 0 To myObjectCollection.Length - 1
          Console.WriteLine(myObjectCollection(i))
      Next i

      ' Retrieve the values from the collection.
      Dim myCollection1 As ICollection = myDiscoveryClientReferenceCollection.Values
      Dim myObjectCollection1(myDiscoveryClientReferenceCollection.Count - 1) As Object
      myCollection1.CopyTo(myObjectCollection1, 0)
      
      Console.WriteLine("The objects in the collection are:")
      For i = 0 To myObjectCollection1.Length - 1
          Console.WriteLine(myObjectCollection1(i))
      Next i
      
      
      Dim myStringUrl1 As String = "https://localhost/dataservice.vsdisco"
      If myDiscoveryClientReferenceCollection.Contains(myStringUrl1) Then
          Console.WriteLine("The document reference {0} is part of the collection.", _
              myStringUrl1)
      End If
   End Sub 'Main

End Class 'MyDiscoveryClientReferenceCollection

[C#] 
using System;
using System.Net;
using System.Collections;
using System.Web.Services.Discovery;

public class MyDiscoveryClientReferenceCollection
{
   public static void Main()
   {
      DiscoveryClientProtocol myDiscoveryClientProtocol =
          new DiscoveryClientProtocol();
      
      myDiscoveryClientProtocol.Credentials = 
          CredentialCache.DefaultCredentials;

      // 'dataservice.vsdisco' is a sample discovery document.
      string myStringUrl = "https://localhost/dataservice.vsdisco";
      
      // 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 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++)
      {
         Console.WriteLine(myObjectCollection[i]);
      }
      Console.WriteLine("");

      // 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++)
      {
         Console.WriteLine(myObjectCollection1[i]);
      }

      Console.WriteLine("");

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

[C++] 
#using <mscorlib.dll>
#using <System.dll>
#using <System.Web.Services.dll>
using namespace System;
using namespace System::Net;
using namespace System::Collections;
using namespace System::Web::Services::Discovery;

int main() {
   DiscoveryClientProtocol* myDiscoveryClientProtocol =
      new DiscoveryClientProtocol();

   myDiscoveryClientProtocol->Credentials =
      CredentialCache::DefaultCredentials;

   // 'dataservice.vsdisco' is a sample discovery document.
   String* myStringUrl = S"https://localhost/dataservice.vsdisco";

   // 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 from the collection.
   ICollection* myCollection = myDiscoveryClientReferenceCollection->Keys;
   Object* myObjectCollection[] =
      new Object*[myDiscoveryClientReferenceCollection->Count];
   myCollection->CopyTo(myObjectCollection, 0);

   Console::WriteLine(S"The discovery documents, service descriptions, and XML schema");
   Console::WriteLine(S" definitions in the collection are: ");
   for (int i=0; i< myObjectCollection->Length; i++) {
      Console::WriteLine(myObjectCollection->Item[i]);
   }
   Console::WriteLine(S"");

   // Retrieve the values from the collection.
   ICollection* myCollection1 = myDiscoveryClientReferenceCollection->Values;
   Object* myObjectCollection1[] =
      new Object*[myDiscoveryClientReferenceCollection->Count];
   myCollection1->CopyTo(myObjectCollection1, 0);

   Console::WriteLine(S"The objects in the collection are: ");
   for (int i=0; i< myObjectCollection1->Length; i++) {
      Console::WriteLine(myObjectCollection1->Item[i]);
   }

   Console::WriteLine(S"");

   String* myStringUrl1 = S"https://localhost/dataservice.vsdisco";
   if (myDiscoveryClientReferenceCollection->Contains(myStringUrl1)) {
      Console::WriteLine(S"The document reference {0} is part of the collection.",
         myStringUrl1);
   }
}

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

名前空間: System.Web.Services.Discovery

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

アセンブリ: System.Web.Services (System.Web.Services.dll 内)

参照

DiscoveryClientReferenceCollection メンバ | System.Web.Services.Discovery 名前空間