Esta página foi útil?
Seus comentários sobre este conteúdo são importantes. Queremos saber sua opinião.
Comentários adicionais?
1500 caracteres restantes
Exportar (0) Imprimir
Expandir Tudo
Este artigo foi traduzido por máquina. Coloque o ponteiro do mouse sobre as frases do artigo para ver o texto original. Mais informações.
Tradução
Original

ImportCollection Classe

Provides a collection of instances of the Import class representing documents to be imported into the XML Web service. Esta classe não pode ser herdada.

Namespace:  System.Web.Services.Description
Assembly:  System.Web.Services (em System.Web.Services. dll)

public sealed class ImportCollection : ServiceDescriptionBaseCollection

The Import class corresponds to the Web Services Description Language (WSDL) <import> element that is enclosed by the root <definitions> element.Para obter mais informações sobre o WSDL, consulte a especificação em http://www.w3.org/TR/wsdl/.

The following example demonstrates a typical use of the ImportCollection class.

using System;
using System.Web.Services.Description;
using System.Xml;

class ServiceDescription_ImportCollection
{
   public static void Main()
   {
      ServiceDescription myServiceDescription = ServiceDescription.Read("StockQuoteService_cs.wsdl");
      Console.WriteLine(" ImportCollection Sample ");
      // Get Import Collection.
      ImportCollection myImportCollection = myServiceDescription.Imports;
      Console.WriteLine("Total Imports in the document = " + myServiceDescription.Imports.Count);
      // Print 'Import' properties to console.
      for(int i =0; i < myImportCollection.Count; ++i)
         Console.WriteLine("\tImport Namespace :{0} Import Location :{1} "
                                       ,myImportCollection[i].Namespace
                                       ,myImportCollection[i].Location);
      Import[] myImports = new Import[myServiceDescription.Imports.Count];
      // Copy 'ImportCollection' to an array.
      myServiceDescription.Imports.CopyTo(myImports,0);
      Console.WriteLine("Imports that are copied to Importarray ...");
      for(int i=0;i < myImports.Length; ++i)
         Console.WriteLine("\tImport Namespace :{0} Import Location :{1} "
                                                ,myImports[i].Namespace
                                                ,myImports[i].Location);
      // Get Import by Index.
      Import myImport = myServiceDescription.Imports[myServiceDescription.Imports.Count-1];
      Console.WriteLine("Import by Index...");
      if (myImportCollection.Contains(myImport))
      {
         Console.WriteLine("Import Namespace '"
                  + myImport.Namespace + "' is found in 'ImportCollection'.");
         Console.WriteLine("Index of '" + myImport.Namespace + "' in 'ImportCollection' = "
                                                   + myImportCollection.IndexOf(myImport));
         Console.WriteLine("Deleting Import from 'ImportCollection'...");
         myImportCollection.Remove(myImport);
         if(myImportCollection.IndexOf(myImport) == -1)
            Console.WriteLine("Import is successfully removed from Import Collection.");
      }
   }
}


import System.*;
import System.Web.Services.Description.*;
import System.Xml.*;

class ServiceDescriptionImportCollection
{
    public static void main(String[] args)
    {
        ServiceDescription myServiceDescription 
            = ServiceDescription.Read("StockQuoteService_jsl.wsdl");
        Console.WriteLine(" ImportCollection Sample ");

        // Get Import Collection.
        ImportCollection myImportCollection 
            = myServiceDescription.get_Imports();

        Console.WriteLine("Total Imports in the document = " 
            + myServiceDescription.get_Imports().get_Count());

        // Print 'Import' properties to console.
        for (int i = 0; i < myImportCollection.get_Count(); ++i) {
            Console.WriteLine("\tImport Namespace :{0} Import Location :{1} ",
                myImportCollection.get_Item(i).get_Namespace(),
                myImportCollection.get_Item(i).get_Location());
        }

        Import myImports[] = new Import[myServiceDescription.
            get_Imports().get_Count()];

        // Copy 'ImportCollection' to an array.
        myServiceDescription.get_Imports().CopyTo(myImports, 0);
        Console.WriteLine("Imports that are copied to Importarray ...");
        for (int i = 0; i < myImports.length; ++i) {
            Console.WriteLine("\tImport Namespace :{0} Import Location :{1} ",
                myImports[i].get_Namespace(), myImports[i].get_Location());
        }

        // Get Import by Index.
        Import myImport = myServiceDescription.get_Imports().
            get_Item(myServiceDescription.get_Imports().get_Count() - 1);

        Console.WriteLine("Import by Index...");
        if (myImportCollection.Contains(myImport)) {
            Console.WriteLine("Import Namespace '" + myImport.get_Namespace() 
                + "' is found in 'ImportCollection'.");
            Console.WriteLine("Index of '" + myImport.get_Namespace() 
                + "' in 'ImportCollection' = " 
                + myImportCollection.IndexOf(myImport));
            Console.WriteLine("Deleting Import from 'ImportCollection'...");
            myImportCollection.Remove(myImport);
            if (myImportCollection.IndexOf(myImport) == -1) {
                Console.WriteLine(
                    "Import is successfully removed from Import Collection.");
            }
        }
    } //main
} //ServiceDescriptionImportCollection 


Quaisquer membros públicos estático (compartilhados na Visual Basic) desse tipo são Thread seguro. Não há garantia de que qualquer membro de instância seja isento de segmentos.

Contribuições da comunidade

ADICIONAR
Mostrar:
© 2015 Microsoft