BindingCollection.Item[] Property

Definition

Gets or sets the Binding instance specified by the parameter passed in.

Overloads

Item[Int32]

Gets or sets the value of a Binding at the specified zero-based index.

Item[String]

Gets a Binding specified by its name.

Item[Int32]

Gets or sets the value of a Binding at the specified zero-based index.

C#
public System.Web.Services.Description.Binding this[int index] { get; set; }

Parameters

index
Int32

The zero-based index of the Binding whose value is modified or returned.

Property Value

A Binding.

Exceptions

The index parameter is less than zero.

-or-

The index parameter is greater than Count.

Examples

C#
 for(int i=0; i < myServiceDescription.Bindings.Count; ++i)
  {	
     Console.WriteLine("\nBinding " + i );
      // Get Binding at index i.
    myBinding = myServiceDescription.Bindings[i];
      Console.WriteLine("\t Name : " + myBinding.Name);
      Console.WriteLine("\t Type : " + myBinding.Type);
}

Applies to

.NET Framework 4.8.1 und andere Versionen
Produkt Versionen
.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)

Item[String]

Gets a Binding specified by its name.

C#
public System.Web.Services.Description.Binding this[string name] { get; }

Parameters

name
String

The name of the Binding returned.

Property Value

A Binding.

Examples

The following example searches the Bindings property of myServiceDescription for a Binding named "MathServiceHttpGet".

C#
// Get Binding Name = "MathServiceSoap".
myBinding = myServiceDescription.Bindings["MathServiceHttpGet"];
if (myBinding != null)
{
   Console.WriteLine("\n\nName : " + myBinding.Name);
   Console.WriteLine("Type : " + myBinding.Type);
}

Applies to

.NET Framework 4.8.1 und andere Versionen
Produkt Versionen
.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)