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.

public:
 property System::Web::Services::Description::Binding ^ default[int] { System::Web::Services::Description::Binding ^ get(int index); void set(int index, System::Web::Services::Description::Binding ^ value); };
public System.Web.Services.Description.Binding this[int index] { get; set; }
member this.Item(int) : System.Web.Services.Description.Binding with get, set
Default Public Property Item(index As Integer) As Binding

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

for ( int i = 0; i < myServiceDescription->Bindings->Count; ++i )
{
   Console::WriteLine( "\nBinding {0}", i );

   // Get Binding at index i.
   myBinding = myServiceDescription->Bindings[ i ];
   Console::WriteLine( "\t Name : {0}", myBinding->Name );
   Console::WriteLine( "\t Type : {0}", myBinding->Type );
}
 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);
}
Dim i As Integer

While i < myServiceDescription.Bindings.Count
   Console.WriteLine((ControlChars.Cr + "Binding " + i.ToString()))
   ' Get Binding at index i.
   myBinding = myServiceDescription.Bindings(i)
   Console.WriteLine((ControlChars.Tab + " Name : " + myBinding.Name))
   Console.WriteLine((ControlChars.Tab + " Type : " + myBinding.Type.ToString()))
   i = i + 1
End While

Applies to

Item[String]

Gets a Binding specified by its name.

public:
 property System::Web::Services::Description::Binding ^ default[System::String ^] { System::Web::Services::Description::Binding ^ get(System::String ^ name); };
public System.Web.Services.Description.Binding this[string name] { get; }
member this.Item(string) : System.Web.Services.Description.Binding
Default Public ReadOnly Property Item(name As String) As Binding

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".

// Get Binding Name = S"MathServiceSoap".
myBinding = myServiceDescription->Bindings[ "MathServiceHttpGet" ];
if ( myBinding != nullptr )
{
   Console::WriteLine( "\n\nName : {0}", myBinding->Name );
   Console::WriteLine( "Type : {0}", myBinding->Type );
}
// Get Binding Name = "MathServiceSoap".
myBinding = myServiceDescription.Bindings["MathServiceHttpGet"];
if (myBinding != null)
{
   Console.WriteLine("\n\nName : " + myBinding.Name);
   Console.WriteLine("Type : " + myBinding.Type);
}
' Get Binding Name = "MathServiceSoap".
myBinding = myServiceDescription.Bindings("MathServiceHttpGet")
If Not (myBinding Is Nothing) Then
   Console.WriteLine((ControlChars.Cr + ControlChars.Cr + "Name : " + myBinding.Name))
   Console.WriteLine(("Type : " + myBinding.Type.ToString()))
End If

Applies to