次の方法で共有


BindingCollection.CopyTo(Binding[], Int32) メソッド

定義

BindingCollection 全体を互換性のある Binding 型の 1 次元配列にコピーします。コピーは、コピー先の配列の、指定した 0 から始まるインデックス番号から開始します。

public:
 void CopyTo(cli::array <System::Web::Services::Description::Binding ^> ^ array, int index);
public void CopyTo (System.Web.Services.Description.Binding[] array, int index);
member this.CopyTo : System.Web.Services.Description.Binding[] * int -> unit
Public Sub CopyTo (array As Binding(), index As Integer)

パラメーター

array
Binding[]

コピー アクションのコピー先として使用する Binding 型の配列。

index
Int32

コピーされたコレクションの貼り付け開始位置を示す、0 から始まるインデックス番号。

array<Binding^>^myBindings = gcnew array<Binding^>(myServiceDescription->Bindings->Count);

// Copy BindingCollection to an Array.
myServiceDescription->Bindings->CopyTo( myBindings, 0 );
Console::WriteLine( "\n\n Displaying array copied from BindingCollection" );
for ( int i = 0; i < myServiceDescription->Bindings->Count; ++i )
{
   Console::WriteLine( "\nBinding {0}", i );
   Console::WriteLine( "\t Name : {0}", myBindings[ i ]->Name );
   Console::WriteLine( "\t Type : {0}", myBindings[ i ]->Type );
}
Binding[] myBindings = new Binding[myServiceDescription.Bindings.Count];
// Copy BindingCollection to an Array.
myServiceDescription.Bindings.CopyTo(myBindings,0);
Console.WriteLine("\n\n Displaying array copied from BindingCollection");
for(int i=0;i < myServiceDescription.Bindings.Count; ++i)
{
   Console.WriteLine("\nBinding " + i );
   Console.WriteLine("\t Name : " + myBindings[i].Name);
   Console.WriteLine("\t Type : " + myBindings[i].Type);
}
Dim myBindings(myServiceDescription.Bindings.Count) As Binding
' Copy BindingCollection to an Array.
myServiceDescription.Bindings.CopyTo(myBindings, 0)
Console.WriteLine(ControlChars.Cr + ControlChars.Cr + " Displaying array copied from BindingCollection")


While i < myServiceDescription.Bindings.Count
   Console.WriteLine((ControlChars.Cr + "Binding " + i))
   Console.WriteLine((ControlChars.Tab + " Name : " + myBindings(i).Name))
   Console.WriteLine((ControlChars.Tab + " Type : " + myBindings(i).Type.ToString()))
End While

適用対象