Поделиться через


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 Свойство DiscoveryClientProtocol типаDiscoveryClientReferenceCollection.

Конструкторы

Имя Описание
DiscoveryClientReferenceCollection()

Инициализирует новый экземпляр класса DiscoveryClientReferenceCollection.

Свойства

Имя Описание
Count

Возвращает количество элементов, содержащихся в экземпляре DictionaryBase .

(Унаследовано от DictionaryBase)
Dictionary

Возвращает список элементов, содержащихся в экземпляре DictionaryBase .

(Унаследовано от DictionaryBase)
InnerHashtable

Возвращает список элементов, содержащихся в экземпляре DictionaryBase .

(Унаследовано от DictionaryBase)
Item[String]

Возвращает или задает DiscoveryReference объект из указанного DiscoveryClientReferenceCollection URL-адреса.

Keys

ICollection Возвращает объект со всеми ключами в элементе DiscoveryClientReferenceCollection.

Values

ICollection Возвращает объект со всеми значениями в объектеDiscoveryClientReferenceCollection.

Методы

Имя Описание
Add(DiscoveryReference)

Добавляет DiscoveryReference в DiscoveryClientReferenceCollection.

Add(String, DiscoveryReference)

Добавляет указанный DiscoveryReference URL-адрес и значение в объект DiscoveryClientReferenceCollection.

Clear()

Очищает содержимое экземпляра DictionaryBase.

(Унаследовано от DictionaryBase)
Contains(String)

Определяет, содержит ли DiscoveryClientReferenceCollection он указанный DiscoveryReference URL-адрес.

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)

Удаляет из него DiscoveryClientReferenceCollectionуказанный DiscoveryReference URL-адрес.

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

Возвращает значение IEnumerator , которое выполняет итерацию через DictionaryBase.

(Унаследовано от DictionaryBase)

Методы расширения

Имя Описание
AsParallel(IEnumerable)

Включает параллелизацию запроса.

AsQueryable(IEnumerable)

Преобразует IEnumerable в IQueryable.

Cast<TResult>(IEnumerable)

Приведение элементов IEnumerable к указанному типу.

OfType<TResult>(IEnumerable)

Фильтрует элементы IEnumerable на основе указанного типа.

Применяется к