BindingCollection.Item[] 属性

定义

获取或设置由传入的参数指定的 Binding 实例。

重载

Item[Int32]

获取或设置位于指定的从零开始的索引处的 Binding 值。

Item[String]

获取由其名称指定的 Binding

Item[Int32]

Source:
ServiceDescription.cs
Source:
ServiceDescription.cs
Source:
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]

Source:
ServiceDescription.cs
Source:
ServiceDescription.cs
Source:
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

示例

以下示例在 myServiceDescription 的 属性中 Bindings 搜索 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

适用于