次の方法で共有


DiscoveryClientResultCollection クラス

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

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

System.Object
   System.Collections.CollectionBase
      System.Web.Services.Discovery.DiscoveryClientResultCollection

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

スレッドセーフ

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

使用例

 
Imports System
Imports System.Reflection
Imports System.IO
Imports System.Web.Services.Discovery
Imports System.Xml.Schema
Imports System.Collections

Public Class MyDiscoveryClientResult
   
   Shared Sub Main()
      Try
         Dim myDiscoveryClientProtocol As New DiscoveryClientProtocol()

         ' Get the collection of DiscoveryClientResult objects.
         Dim myDiscoveryClientResultCollection As _
             DiscoveryClientResultCollection = _
             myDiscoveryClientProtocol.ReadAll("results.discomap")
         Console.WriteLine( _
             "Removing a DiscoveryClientResult from the collection...")

         ' Remove the first DiscoveryClientResult from the collection.
         myDiscoveryClientResultCollection.Remove( _
             myDiscoveryClientResultCollection(0))
         Console.WriteLine("Adding a DiscoveryClientResult" & _
             " to the collection...")
         Dim myDiscoveryClientResult As New DiscoveryClientResult()

         ' Set the DiscoveryDocumentReference class as the type of 
         ' reference in the discovery document.
         myDiscoveryClientResult.ReferenceTypeName = _
             "System.Web.Services.Discovery.DiscoveryDocumentReference"

         ' Set the URL for the reference.
         myDiscoveryClientResult.Url = _
             "https://localhost/Discovery/Service1_vb.asmx?disco"

         ' Set the name of the file in which the reference is saved.
         myDiscoveryClientResult.Filename = "Service1_vb.disco"

         ' Add myDiscoveryClientResult to the collection.
         myDiscoveryClientResultCollection.Add(myDiscoveryClientResult)

         If myDiscoveryClientResultCollection.Contains( _ 
             myDiscoveryClientResult) Then

             Console.WriteLine( _
                 "Instance of DiscoveryClientResult found in the Collection")
         End If

      Catch ex As Exception
         Console.WriteLine("Error is " + ex.Message)
      End Try
   End Sub 'Main
End Class 'MyDiscoveryClientResult

[C#] 
using System;
using System.Reflection;
using System.IO;
using System.Web.Services.Discovery;
using System.Xml.Schema;
using System.Collections;

public class MyDiscoveryClientResult
{
   static void Main()
   {
      try
      {
         DiscoveryClientProtocol myDiscoveryClientProtocol = 
             new DiscoveryClientProtocol();

         // Get the collection of DiscoveryClientResult objects.
         DiscoveryClientResultCollection myDiscoveryClientResultCollection =
             myDiscoveryClientProtocol.ReadAll("results.discomap");
         Console.WriteLine(
             "Removing a DiscoveryClientResult from the collection...");

         // Remove the first DiscoveryClientResult from the collection.
         myDiscoveryClientResultCollection.Remove(
             myDiscoveryClientResultCollection[0]);
         Console.WriteLine("Adding a DiscoveryClientResult" +
             " to the collection...");
         DiscoveryClientResult myDiscoveryClientResult = 
             new DiscoveryClientResult();

         // Set the DiscoveryDocumentReference class as the type of 
         // reference in the discovery document.
         myDiscoveryClientResult.ReferenceTypeName = 
             "System.Web.Services.Discovery.DiscoveryDocumentReference";

         // Set the URL for the reference.
         myDiscoveryClientResult.Url = 
             "https://localhost/Discovery/Service1_cs.asmx?disco";

         // Set the name of the file in which the reference is saved.
         myDiscoveryClientResult.Filename = "Service1_cs.disco";

         // Add myDiscoveryClientResult to the collection.
         myDiscoveryClientResultCollection.Add(myDiscoveryClientResult);
         if(myDiscoveryClientResultCollection.Contains(myDiscoveryClientResult))
         {
            Console.WriteLine(
                "Instance of DiscoveryClientResult found in the Collection");
         }
      }
      catch(Exception ex)
      {
         Console.WriteLine("Error is "+ex.Message);
      }
   }
}

[C++] 
#using <mscorlib.dll>
#using <System.Xml.dll>
#using <System.Web.Services.dll>
#using <System.dll>
using namespace System;
using namespace System::Reflection;
using namespace System::IO;
using namespace System::Web::Services::Discovery;
using namespace System::Xml::Schema;
using namespace System::Collections;

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

      // Get the collection of DiscoveryClientResult objects.
      DiscoveryClientResultCollection* myDiscoveryClientResultCollection =
         myDiscoveryClientProtocol->ReadAll(S"results.discomap");
      Console::WriteLine(
         S"Removing a DiscoveryClientResult from the collection...");

      // Remove the first DiscoveryClientResult from the collection.
      myDiscoveryClientResultCollection->Remove(
         myDiscoveryClientResultCollection->Item[0]);
      Console::WriteLine(S"Adding a DiscoveryClientResult to the collection...");
      DiscoveryClientResult* myDiscoveryClientResult = 
         new DiscoveryClientResult();

      // Set the DiscoveryDocumentReference class as the type of 
      // reference in the discovery document.
      myDiscoveryClientResult->ReferenceTypeName = 
         S"System.Web.Services.Discovery.DiscoveryDocumentReference";

      // Set the URL for the reference.
      myDiscoveryClientResult->Url = 
         S"https://localhost/Discovery/Service1_cs.asmx?disco";

      // Set the name of the file in which the reference is saved.
      myDiscoveryClientResult->Filename = S"Service1_cs.disco";

      // Add myDiscoveryClientResult to the collection.
      myDiscoveryClientResultCollection->Add(myDiscoveryClientResult);
      if(myDiscoveryClientResultCollection->Contains(myDiscoveryClientResult))
      {
         Console::WriteLine(
            S"Instance of DiscoveryClientResult found in the Collection");
      }
   }
   catch(Exception* ex)
   {
      Console::WriteLine(S"Error is {0}", ex->Message);
   }
}

[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 内)

参照

DiscoveryClientResultCollection メンバ | System.Web.Services.Discovery 名前空間 | DiscoveryClientResult | CollectionBase | IList