共用方式為


BindingCollection.Item[] 屬性

定義

取得或設定傳入參數所指定的 Binding 執行個體。

多載

Item[Int32]

取得或設定 Binding 的值,於指定的以零起始的索引位置。

Item[String]

取得由其名稱所指定的 Binding

Item[Int32]

來源:
ServiceDescription.cs
來源:
ServiceDescription.cs
來源:
ServiceDescription.cs

取得或設定 Binding 的值,於指定的以零起始的索引位置。

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

參數

index
Int32

Binding (其值已修改或傳回) 的以零起始的索引。

屬性值

Binding

例外狀況

index 參數小於零。

-或-

index 參數大於 Count

範例

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

適用於

Item[String]

來源:
ServiceDescription.cs
來源:
ServiceDescription.cs
來源:
ServiceDescription.cs

取得由其名稱所指定的 Binding

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

參數

name
String

傳回的 Binding 的名稱。

屬性值

Binding

範例

下列範例會在 Bindings myServiceDescription 的 屬性中搜尋 Binding 名為 「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

適用於