BindingCollection.CopyTo(Binding[], Int32) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
複製整個 BindingCollection 至 Binding 型別的相容一維陣列,從目標陣列的指定以零起始的索引位置開始。
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)
參數
- index
- Int32
以零起始的索引,要於此處開始放置複製的集合。
範例
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