DiscoveryClientResult 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
表示發現參考的細節,但不含所參考文件的內容。 此類別無法獲得繼承。
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
備註
利用 WriteAllDiscoveryClientProtocol的方法,所有有效的參考文件及包含所有存檔文件映射的檔案都可以寫入磁碟。 包含所有已儲存文件映射的檔案,包含每份文件的詳細資料,並由 的 DiscoveryClientResult屬性彙整。
在使用 WriteAll 該方法將參考文件及相關文件的映射寫入磁碟後,您可以呼叫 ReadAll 該方法來讀取發現文件。
建構函式
| 名稱 | Description |
|---|---|
| DiscoveryClientResult() |
初始化 DiscoveryClientResult 類別的新執行個體。 |
| DiscoveryClientResult(Type, String, String) |
初始化該類別的新實例DiscoveryClientResult,並將屬性ReferenceTypeName設為 ,屬性為 , |
屬性
| 名稱 | Description |
|---|---|
| Filename |
取得或設定儲存參考的檔案名稱。 |
| ReferenceTypeName |
代表發現文件中引用類型的類別名稱。 |
| Url |
取得或設定參考的網址。 |
方法
| 名稱 | Description |
|---|---|
| Equals(Object) |
判斷指定的物件是否等於目前的物件。 (繼承來源 Object) |
| GetHashCode() |
做為預設哈希函式。 (繼承來源 Object) |
| GetType() |
取得目前實例的 Type。 (繼承來源 Object) |
| MemberwiseClone() |
建立目前 Object的淺層複本。 (繼承來源 Object) |
| ToString() |
傳回表示目前 物件的字串。 (繼承來源 Object) |