次の方法で共有


BindingCollection.IndexOf メソッド

指定した Binding を検索し、コレクション内で最初に見つかった位置の 0 から始まるインデックス番号を返します。

Public Function IndexOf( _
   ByVal binding As Binding _) As Integer
[C#]
public int IndexOf(Bindingbinding);
[C++]
public: int IndexOf(Binding* binding);
[JScript]
public function IndexOf(
   binding : Binding) : int;

パラメータ

  • binding
    コレクション内での検索対象となる Binding

戻り値

32 ビット符号付き整数。

使用例

 
Dim myServiceDescription As ServiceDescription = ServiceDescription.Read("MathService_input.wsdl")
Console.WriteLine(("Total Number of bindings defined are:" + myServiceDescription.Bindings.Count.ToString()))
myBinding = myServiceDescription.Bindings(0)

' Remove the first binding in the collection.
myServiceDescription.Bindings.Remove(myBinding)
Console.WriteLine(("Successfully removed binding " + myBinding.Name))
Console.WriteLine(("Total Number of bindings defined now are:" + myServiceDescription.Bindings.Count.ToString()))
myServiceDescription.Write("MathService_temp.wsdl")
' Add binding to the ServiceDescription instance.
myServiceDescription.Bindings.Add(myBinding)
If myServiceDescription.Bindings.Contains(myBinding) Then
   Console.WriteLine(("Successfully added binding " + myBinding.Name))
Console.WriteLine(("Binding was added at index " + myServiceDescription.Bindings.IndexOf(myBinding).ToString()))
Console.WriteLine(("Total Number of bindings defined now are:" + myServiceDescription.Bindings.Count.ToString()))
myServiceDescription.Write("MathService_temp1.wsdl")

[C#] 
ServiceDescription myServiceDescription = ServiceDescription.Read("MathService_input.wsdl");
 Console.WriteLine("Total Number of bindings defined are:" + myServiceDescription.Bindings.Count);
  myBinding = myServiceDescription.Bindings[0];
 
 // Remove the first binding in the collection.
 myServiceDescription.Bindings.Remove(myBinding);
 Console.WriteLine("Successfully removed binding " + myBinding.Name);
 Console.WriteLine("Total Number of bindings defined now are:" + myServiceDescription.Bindings.Count);
 myServiceDescription.Write("MathService_temp.wsdl");
 // Add binding to the ServiceDescription instance.
 myServiceDescription.Bindings.Add(myBinding);
if (myServiceDescription.Bindings.Contains(myBinding))
    Console.WriteLine("Successfully added binding " + myBinding.Name);
Console.WriteLine("Binding was added at index " + myServiceDescription.Bindings.IndexOf(myBinding));
Console.WriteLine("Total Number of bindings defined now are:" + myServiceDescription.Bindings.Count);
myServiceDescription.Write("MathService_temp1.wsdl");

[C++] 
ServiceDescription * myServiceDescription = ServiceDescription::Read(S"MathService_input.wsdl");
Console::WriteLine(S"Total Number of bindings defined are: {0}", __box(myServiceDescription -> Bindings->Count));
myBinding = myServiceDescription -> Bindings->Item[0];

// Remove the first binding in the collection.
myServiceDescription -> Bindings -> Remove(myBinding);
Console::WriteLine(S"Successfully removed binding {0}", myBinding -> Name);
Console::WriteLine(S"Total Number of bindings defined now are: {0}", __box(myServiceDescription -> Bindings->Count));
myServiceDescription -> Write(S"MathService_temp.wsdl");
// Add binding to the ServiceDescription instance.
myServiceDescription -> Bindings->Add(myBinding);
if (myServiceDescription -> Bindings -> Contains(myBinding))
   Console::WriteLine(S"Successfully added binding {0}", myBinding -> Name);
Console::WriteLine(S"Binding was added at index {0}", __box(myServiceDescription -> Bindings -> IndexOf(myBinding)));
Console::WriteLine(S"Total Number of bindings defined now are: {0}", __box(myServiceDescription -> Bindings->Count));
myServiceDescription -> Write(S"MathService_temp1.wsdl");

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

BindingCollection クラス | BindingCollection メンバ | System.Web.Services.Description 名前空間