This documentation is archived and is not being maintained.

BindingCollection.CopyTo Method

Copies the entire BindingCollection to a compatible one-dimensional array of type Binding, starting at the specified zero-based index of the target array.

[Visual Basic]
Public Sub CopyTo( _
   ByVal array() As Binding, _
   ByVal index As Integer _
)
[C#]
public void CopyTo(
 Binding[] array,
 int index
);
[C++]
public: void CopyTo(
 Binding* array[],
 int index
);
[JScript]
public function CopyTo(
   array : Binding[],
 index : int
);

Parameters

array
An array of type Binding serving as the destination for the copy action.
index
The zero-based index at which to start placing the copied collection.

Example

[Visual Basic] 
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

[C#] 
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);
}

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

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

BindingCollection Class | BindingCollection Members | System.Web.Services.Description Namespace

Show: