DiscoveryClientResult 类

定义

表示发现引用的详细信息,但不包含被引用文档的内容。 此类不能被继承。

public ref class DiscoveryClientResult sealed
public sealed class DiscoveryClientResult
type DiscoveryClientResult = class
Public NotInheritable Class DiscoveryClientResult
继承
DiscoveryClientResult

示例

#using <System.Web.Services.dll>
#using <System.dll>

using namespace System;
using namespace System::Web::Services::Discovery;
int main()
{
   try
   {
      DiscoveryClientProtocol^ myDiscoveryClientProtocol = gcnew DiscoveryClientProtocol;
      
      // Get the collection holding DiscoveryClientResult objects.
      DiscoveryClientResultCollection^ myDiscoveryClientResultCollection = myDiscoveryClientProtocol->ReadAll( "results.discomap" );
      Console::WriteLine( "The number of DiscoveryClientResult objects: {0}", myDiscoveryClientResultCollection->Count );
      Console::WriteLine( "Displaying the items in the collection:" );
      
      // Iterate through the collection and display the properties
      // of each DiscoveryClientResult in it.
      System::Collections::IEnumerator^ myEnum = myDiscoveryClientResultCollection->GetEnumerator();
      while ( myEnum->MoveNext() )
      {
         DiscoveryClientResult^ myDiscoveryClientResult = safe_cast<DiscoveryClientResult^>(myEnum->Current);
         Console::WriteLine( "Type of reference in the discovery document: {0}", myDiscoveryClientResult->ReferenceTypeName );
         Console::WriteLine( "Url for the reference: {0}", myDiscoveryClientResult->Url );
         Console::WriteLine( "File for saving the reference: {0}", myDiscoveryClientResult->Filename );
      }
   }
   catch ( Exception^ e ) 
   {
      Console::WriteLine( "Error is {0}", e->Message );
   }

}
using System;
using System.Web.Services.Discovery;
public class MyDiscoveryClientResult
{
    static void Main()
    {
        try
        {
            DiscoveryClientProtocol myDiscoveryClientProtocol =
                new DiscoveryClientProtocol();

            // Get the collection holding DiscoveryClientResult objects.
            DiscoveryClientResultCollection myDiscoveryClientResultCollection =
                myDiscoveryClientProtocol.ReadAll("results.discomap");
            Console.WriteLine("The number of DiscoveryClientResult objects: "
                + myDiscoveryClientResultCollection.Count);
            Console.WriteLine("Displaying the items in the collection:");

            // Iterate through the collection and display the properties
            // of each DiscoveryClientResult in it.
            foreach(DiscoveryClientResult myDiscoveryClientResult in
                myDiscoveryClientResultCollection)
            {
                Console.WriteLine(
                    "Type of reference in the discovery document: "
                    + myDiscoveryClientResult.ReferenceTypeName);
                Console.WriteLine("Url for the reference: "
                    + myDiscoveryClientResult.Url);
                Console.WriteLine("File for saving the reference: "
                    + myDiscoveryClientResult.Filename);
            }
        }
        catch(Exception e)
        {
            Console.WriteLine("Error is " + e.Message);
        }
    }
}
Imports System.Web.Services.Discovery

Public Class MyDiscoveryClientResult

    Shared Sub Main()
        Try
            Dim myDiscoveryClientProtocol As New DiscoveryClientProtocol()

            ' Get the collection holding DiscoveryClientResult objects.
            Dim myDiscoveryClientResultCollection As _
                DiscoveryClientResultCollection = _
                myDiscoveryClientProtocol.ReadAll("results.discomap")
            Console.WriteLine("The number of DiscoveryClientResult objects: " _
                & myDiscoveryClientResultCollection.Count.ToString())
            Console.WriteLine("Displaying the items in the collection:")

            ' Iterate through the collection and display the properties
            ' of each DiscoveryClientResult in it.
            Dim myDiscoveryClientResult As DiscoveryClientResult
            For Each myDiscoveryClientResult In myDiscoveryClientResultCollection
                Console.WriteLine( _
                    "Type of reference in the discovery document: " _
                    & myDiscoveryClientResult.ReferenceTypeName)
                Console.WriteLine("Url for the reference: " _
                    & myDiscoveryClientResult.Url)
                Console.WriteLine("File for saving the reference: " _
                    & myDiscoveryClientResult.Filename)
            Next myDiscoveryClientResult
        Catch e As Exception
            Console.WriteLine("Error is " + e.Message)
        End Try
    End Sub
End Class

注解

WriteAll使用该方法DiscoveryClientProtocol,所有有效的引用文档和包含所有保存文档映射的文件都可以写入磁盘。 包含所有已保存文档的映射的文件包含每个文档的详细信息,这些详细信息由属性 DiscoveryClientResult汇总。

使用 WriteAll 该方法将引用的文档和所引用文档的映射写入磁盘后,可以调用 ReadAll 该方法来读取发现文档。

构造函数

DiscoveryClientResult()

初始化 DiscoveryClientResult 类的新实例。

DiscoveryClientResult(Type, String, String)

初始化 DiscoveryClientResult 类的新实例并将 ReferenceTypeName 属性设置为 referenceType,将 Url 属性设置为 url,并将 Filename 属性设置为 filename

属性

Filename

获取或设置将引用保存到其中的文件的名称。

ReferenceTypeName

表示发现文档中引用类型的类的名称。

Url

获取或设置引用的 URL。

方法

Equals(Object)

确定指定对象是否等于当前对象。

(继承自 Object)
GetHashCode()

作为默认哈希函数。

(继承自 Object)
GetType()

获取当前实例的 Type

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。

(继承自 Object)
ToString()

返回表示当前对象的字符串。

(继承自 Object)

适用于