PortCollection.Remove(Port) Yöntem

Tanım

belirtilen Port öğesinin ilk oluşumunu içinden PortCollectionkaldırır.

C#
public void Remove(System.Web.Services.Description.Port port);

Parametreler

port
Port

Port koleksiyondan kaldırılacak.

Örnekler

C#
Service myService;
PortCollection myPortCollection;

ServiceDescription myServiceDescription =
   ServiceDescription.Read("MathServiceItem_cs.wsdl");

Console.WriteLine("Total number of services : "
   + myServiceDescription.Services.Count);

for(int i=0; i < myServiceDescription.Services.Count; ++i)
{
   myService = myServiceDescription.Services[i];
   Console.WriteLine("Name : " + myService.Name);

   myPortCollection = myService.Ports;

   // Create an array of ports.
   Console.WriteLine("\nPort collection :");
   for(int i1=0 ; i1 < myService.Ports.Count ; ++i1)
   {
      Console.WriteLine("Port[" + i1+"] : " +
         myPortCollection[i1].Name);
   }

   string strPort = myPortCollection[0].Name;
   Port myPort = myPortCollection[strPort];
   Console.WriteLine("\nIndex of Port[" + strPort + "] : " +
      myPortCollection.IndexOf(myPort));


   Port myPortTestRemove = myPortCollection[0];

   Console.WriteLine("\nTotal number of ports before removing "
      + "a port '" + myPortTestRemove.Name +"' is : "
      + myService.Ports.Count);

   myPortCollection.Remove(myPortTestRemove);

   Console.WriteLine("Total number of ports after removing "
      + "a port '" + myPortTestRemove.Name +"' is : "
      + myService.Ports.Count);

   // Create the WSDL file.
   myPortCollection.Insert(0, myPortTestRemove);
   myServiceDescription.Write("MathServiceItemNew_cs.wsdl");

Açıklamalar

Bu yöntem doğrusal bir arama gerçekleştirir; bu nedenle, ortalama yürütme süresi ile Countorantılıdır.

Kaldırılan Port noktayı izleyen öğeler, boşaltılan noktayı kaplayan yukarı taşınır.

Şunlara uygulanır

Ürün Sürümler
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)