Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
DiscoveryReferenceCollection Class

DiscoveryReferenceCollection Class

A collection of discovery references. This class cannot be inherited.

Namespace: System.Web.Services.Discovery
Assembly: System.Web.Services (in system.web.services.dll)

'Declaration
Public NotInheritable Class DiscoveryReferenceCollection
	Inherits CollectionBase
'Usage
Dim instance As DiscoveryReferenceCollection

public final class DiscoveryReferenceCollection extends CollectionBase
public final class DiscoveryReferenceCollection extends CollectionBase
Not applicable.

Imports System
Imports System.IO
Imports System.Web.Services.Discovery

Class MyDiscoveryDocumentMod

   Shared Sub Main()
   Try
      Dim myDiscoveryDocReference1 As New DiscoveryDocumentReference()
      Dim myDiscoveryDocReference2 As New DiscoveryDocumentReference()
      Dim myDiscoveryReference As DiscoveryReference

      Console.WriteLine("Demonstrating DiscoveryReferenceCollection class.")

      ' Create new DiscoveryReferenceCollection.
      Dim myDiscoveryReferenceCollection As New DiscoveryReferenceCollection()

      ' Access the Count method.
      Console.WriteLine("The number of elements in collection is: " & _
         myDiscoveryReferenceCollection.Count.ToString())

      ' Add elements to the collection.
      myDiscoveryReferenceCollection.Add(myDiscoveryDocReference1)
      myDiscoveryReferenceCollection.Add(myDiscoveryDocReference2)

      Console.WriteLine("The number of elements in the collection " _
         & "after adding two elements to the collection: " _
         & myDiscoveryReferenceCollection.Count.ToString())

      ' Call the Contains method.
      If myDiscoveryReferenceCollection.Contains(myDiscoveryDocReference1) _
         <> True Then
         Throw New Exception("Element not found in collection.")
      End If

      ' Access the Item property.
      myDiscoveryReference = myDiscoveryReferenceCollection.Item(0)

      If  myDiscoveryReference Is Nothing Then
         Throw New Exception("Element not found in collection.")
      End If

      ' Remove one element from the collection.
      myDiscoveryReferenceCollection.Remove(myDiscoveryDocReference1)
      Console.WriteLine("The number of elements in collection " _
         & "after removing one element is: " _
         & myDiscoveryReferenceCollection.Count.ToString())

   Catch e As Exception
       Console.Writeline("Exception occured : " + e.Message)
   End Try
   End Sub

End Class

import System.*;
import System.IO.*;
import System.Web.Services.Discovery.*;

class MyDiscoveryDocumentClass
{
    public static void main(String[] args) throws Exception 
    {
        DiscoveryDocumentReference myDiscoveryDocReference1 = 
            new DiscoveryDocumentReference();
        DiscoveryDocumentReference myDiscoveryDocReference2 = 
            new DiscoveryDocumentReference();
        DiscoveryReference myDiscoveryReference;
        Console.WriteLine("Demonstrating DiscoveryReferenceCollection class.");

        // Create new DiscoveryReferenceCollection.
        DiscoveryReferenceCollection myDiscoveryReferenceCollection = 
            new DiscoveryReferenceCollection();

        // Access the Count method.
        Console.WriteLine("The number of elements in the collection is: " 
            + ((Int32)myDiscoveryReferenceCollection.get_Count()).ToString());

        // Add elements to the collection.
        myDiscoveryReferenceCollection.Add(myDiscoveryDocReference1);
        myDiscoveryReferenceCollection.Add(myDiscoveryDocReference2);
        Console.WriteLine("The number of elements in the collection "
            + "after adding two elements to the collection: "
            + ((Int32)myDiscoveryReferenceCollection.get_Count()).ToString());

        // Call the Contains method.
        if (myDiscoveryReferenceCollection.
            Contains(myDiscoveryDocReference1) != true) {
            throw new Exception("Element not found in collection.");
        }

        // Access the indexed member.
        myDiscoveryReference = (DiscoveryReference)
            myDiscoveryReferenceCollection.get_Item(0);
        if (myDiscoveryReference == null) {
            throw new Exception("Element not found in collection.");
        }

        // Remove one element from collection.
        myDiscoveryReferenceCollection.Remove(myDiscoveryDocReference1);
        Console.WriteLine("The number of elements in the collection " 
            + "after removing one element is: " 
            + ((Int32)myDiscoveryReferenceCollection.get_Count()).ToString());
    } //main
} //MyDiscoveryDocumentClass

System.Object
   System.Collections.CollectionBase
    System.Web.Services.Discovery.DiscoveryReferenceCollection

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2015 Microsoft