DiscoveryClientReferenceCollection 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
表示 DiscoveryReference 物件的集合。 此類別無法獲得繼承。
public ref class DiscoveryClientReferenceCollection sealed : System::Collections::DictionaryBase
public sealed class DiscoveryClientReferenceCollection : System.Collections.DictionaryBase
type DiscoveryClientReferenceCollection = class
inherit DictionaryBase
Public NotInheritable Class DiscoveryClientReferenceCollection
Inherits DictionaryBase
- 繼承
範例
#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 = gcnew DiscoveryClientProtocol;
myDiscoveryClientProtocol->Credentials = CredentialCache::DefaultCredentials;
// 'dataservice.vsdisco' is a sample discovery document.
String^ myStringUrl = "http://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;
array<Object^>^myObjectCollection = gcnew array<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;
array<Object^>^myObjectCollection1 = gcnew array<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 = "http://localhost/dataservice.vsdisco";
if ( myDiscoveryClientReferenceCollection->Contains( myStringUrl1 ) )
{
Console::WriteLine( "The document reference {0} is part of the collection.", myStringUrl1 );
}
}
using System;
using System.Net;
using System.Collections;
using System.Security.Permissions;
using System.Web.Services.Discovery;
class MyDiscoveryClientReferenceCollection
{
static void Main()
{
Run();
}
[PermissionSetAttribute(SecurityAction.Demand, Name="FullTrust")]
static void Run()
{
DiscoveryClientProtocol myDiscoveryClientProtocol =
new DiscoveryClientProtocol();
myDiscoveryClientProtocol.Credentials =
CredentialCache.DefaultCredentials;
// 'dataservice.vsdisco' is a sample discovery document.
string myStringUrl = "http://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 = "http://localhost/dataservice.vsdisco";
if (myDiscoveryClientReferenceCollection.Contains(myStringUrl1))
{
Console.WriteLine("The document reference {0} is part of the collection.",
myStringUrl1);
}
}
}
Imports System.Net
Imports System.Collections
Imports System.Security.Permissions
Imports System.Web.Services.Discovery
Class MyDiscoveryClientReferenceCollection
Shared Sub Main()
Run()
End Sub
<PermissionSetAttribute(SecurityAction.Demand, Name := "FullTrust")> _
Shared Sub Run()
Dim myDiscoveryClientProtocol As New DiscoveryClientProtocol()
myDiscoveryClientProtocol.Credentials = CredentialCache.DefaultCredentials
' 'dataservice.vsdisco' is a sample discovery document.
Dim myStringUrl As String = "http://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 = "http://localhost/dataservice.vsdisco"
If myDiscoveryClientReferenceCollection.Contains(myStringUrl1) Then
Console.WriteLine("The document reference {0} is part of the collection.", _
myStringUrl1)
End If
End Sub
End Class
備註
的 References DiscoveryClientProtocol 屬性的類型為 DiscoveryClientReferenceCollection 。
建構函式
DiscoveryClientReferenceCollection() |
初始化 DiscoveryClientReferenceCollection 類別的新執行個體。 |
屬性
Count |
取得 DictionaryBase 執行個體中包含的元素數目。 (繼承來源 DictionaryBase) |
Dictionary |
取得包含於 DictionaryBase 執行個體中的項目清單。 (繼承來源 DictionaryBase) |
InnerHashtable |
取得包含於 DictionaryBase 執行個體中的項目清單。 (繼承來源 DictionaryBase) |
Item[String] |
使用指定的 URL,從 DiscoveryReference 取得或設定 DiscoveryClientReferenceCollection 物件。 |
Keys |
取得具有 ICollection 中所有索引鍵的 DiscoveryClientReferenceCollection 物件。 |
Values |
取得具有 ICollection 中所有數值的 DiscoveryClientReferenceCollection 物件。 |
方法
明確介面實作
ICollection.IsSynchronized |
取得值,指出對 DictionaryBase 物件的存取是否為同步的 (執行緒安全)。 (繼承來源 DictionaryBase) |
ICollection.SyncRoot |
取得可用來同步存取 DictionaryBase 物件的物件。 (繼承來源 DictionaryBase) |
IDictionary.Add(Object, Object) |
將有指定索引鍵和數值的項目加入 DictionaryBase。 (繼承來源 DictionaryBase) |
IDictionary.Contains(Object) |
判斷 DictionaryBase 是否包含特定索引鍵。 (繼承來源 DictionaryBase) |
IDictionary.IsFixedSize |
取得值,指出 DictionaryBase 物件是否具有固定的大小。 (繼承來源 DictionaryBase) |
IDictionary.IsReadOnly |
取得值,指出 DictionaryBase 物件是否為唯讀。 (繼承來源 DictionaryBase) |
IDictionary.Item[Object] |
取得或設定與指定之索引鍵相關聯的值。 (繼承來源 DictionaryBase) |
IDictionary.Keys |
取得 ICollection 物件,其中包含 DictionaryBase 物件中的索引鍵。 (繼承來源 DictionaryBase) |
IDictionary.Remove(Object) |
將有指定索引鍵的項目從 DictionaryBase 移除。 (繼承來源 DictionaryBase) |
IDictionary.Values |
取得 ICollection 物件,其中含有 DictionaryBase 物件中的值。 (繼承來源 DictionaryBase) |
IEnumerable.GetEnumerator() |
傳回透過 IEnumerator 重複的 DictionaryBase。 (繼承來源 DictionaryBase) |
擴充方法
Cast<TResult>(IEnumerable) |
將 IEnumerable 的項目轉換成指定的型別。 |
OfType<TResult>(IEnumerable) |
根據指定的型別來篩選 IEnumerable 的項目。 |
AsParallel(IEnumerable) |
啟用查詢的平行化作業。 |
AsQueryable(IEnumerable) |
將 IEnumerable 轉換成 IQueryable。 |