Export (0) Print
Expand All

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.

Namespace: System.Web.Services.Description
Assembly: System.Web.Services (in system.web.services.dll)

public void CopyTo (
	Binding[] array,
	int index
)
public void CopyTo (
	Binding[] array, 
	int index
)
public function CopyTo (
	array : Binding[], 
	index : int
)
Not applicable.

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.

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);
}

Binding myBindings[] = 
    new Binding[myServiceDescription.get_Bindings().get_Count()];

// Copy BindingCollection to an Array.
myServiceDescription.get_Bindings().CopyTo(myBindings, 0);
Console.WriteLine("\n\n Displaying array copied from BindingCollection");
for (int i = 0; i < myServiceDescription.get_Bindings().get_Count(); 
    ++i) {
    Console.WriteLine("\nBinding " + i);
    Console.WriteLine("\t Name : " 
        + ((Binding)myBindings.get_Item(i)).get_Name());
    Console.WriteLine("\t Type : " 
        + ((Binding)myBindings.get_Item(i)).get_Type());
}

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft