DiscoveryClientReferenceCollection 类

定义

表示 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
继承
DiscoveryClientReferenceCollection

示例

#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的类型DiscoveryClientProtocolDiscoveryClientReferenceCollection为 .

构造函数

DiscoveryClientReferenceCollection()

初始化 DiscoveryClientReferenceCollection 类的新实例。

属性

Count

获取 DictionaryBase 实例中包含的元素数。

(继承自 DictionaryBase)
Dictionary

获取 DictionaryBase 实例中包含的元素的列表。

(继承自 DictionaryBase)
InnerHashtable

获取 DictionaryBase 实例中包含的元素的列表。

(继承自 DictionaryBase)
Item[String]

在具有指定 URL 的 DiscoveryReference 中获取或设置一个 DiscoveryClientReferenceCollection 对象。

Keys

获取一个 ICollection 对象,它具有 DiscoveryClientReferenceCollection 中的所有键。

Values

获取一个 ICollection 对象,它具有 DiscoveryClientReferenceCollection 中的所有值。

方法

Add(DiscoveryReference)

DiscoveryReference 中添加一个 DiscoveryClientReferenceCollection

Add(String, DiscoveryReference)

将具有指定的 URL 和值的 DiscoveryReference 添加到 DiscoveryClientReferenceCollection

Clear()

清除 DictionaryBase 实例的内容。

(继承自 DictionaryBase)
Contains(String)

确定 DiscoveryClientReferenceCollection 是否包含具有指定的 URL 的 DiscoveryReference

CopyTo(Array, Int32)

DictionaryBase 元素复制到位于指定索引处的一维 Array 中。

(继承自 DictionaryBase)
Equals(Object)

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

(继承自 Object)
GetEnumerator()

返回循环访问 IDictionaryEnumerator 实例的 DictionaryBase

(继承自 DictionaryBase)
GetHashCode()

作为默认哈希函数。

(继承自 Object)
GetType()

获取当前实例的 Type

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。

(继承自 Object)
OnClear()

在清除 DictionaryBase 实例的内容之前执行其他自定义进程。

(继承自 DictionaryBase)
OnClearComplete()

在清除 DictionaryBase 实例的内容之后执行其他自定义进程。

(继承自 DictionaryBase)
OnGet(Object, Object)

获取 DictionaryBase 实例中带有指定键和值的元素。

(继承自 DictionaryBase)
OnInsert(Object, Object)

在向 DictionaryBase 实例中插入新元素之前执行其他自定义进程。

(继承自 DictionaryBase)
OnInsertComplete(Object, Object)

在向 DictionaryBase 实例中插入新元素之后执行其他自定义进程。

(继承自 DictionaryBase)
OnRemove(Object, Object)

当从 DictionaryBase 实例移除元素时执行其他自定义进程。

(继承自 DictionaryBase)
OnRemoveComplete(Object, Object)

在从 DictionaryBase 实例中移除元素之后执行其他自定义进程。

(继承自 DictionaryBase)
OnSet(Object, Object, Object)

当在 DictionaryBase 实例中设置值之前执行其他自定义进程。

(继承自 DictionaryBase)
OnSetComplete(Object, Object, Object)

当在 DictionaryBase 实例中设置值后执行其他自定义进程。

(继承自 DictionaryBase)
OnValidate(Object, Object)

在验证具有指定键和值的元素时执行其他自定义进程。

(继承自 DictionaryBase)
Remove(String)

DiscoveryReference 中移除具有指定的 URL 的 DiscoveryClientReferenceCollection

ToString()

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

(继承自 Object)

显式接口实现

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()

返回循环访问 IEnumeratorDictionaryBase

(继承自 DictionaryBase)

扩展方法

Cast<TResult>(IEnumerable)

IEnumerable 的元素强制转换为指定的类型。

OfType<TResult>(IEnumerable)

根据指定类型筛选 IEnumerable 的元素。

AsParallel(IEnumerable)

启用查询的并行化。

AsQueryable(IEnumerable)

IEnumerable 转换为 IQueryable

适用于