SoapHeaderCollection.CopyTo Method
Copies the elements of the SoapHeaderCollection to an Array, starting at a particular index of the Array.
[Visual Basic] Public Sub CopyTo( _ ByVal array() As SoapHeader, _ ByVal index As Integer _ ) [C#] public void CopyTo( SoapHeader[] array, int index ); [C++] public: void CopyTo( SoapHeader* array[], int index ); [JScript] public function CopyTo( array : SoapHeader[], index : int );
Parameters
- array
- The one-dimensional Array that is the destination of the elements copied from SoapHeaderCollection. The array must have zero-based indexing.
- index
- The zero-based index in the array parameter at which copying begins.
Exceptions
| Exception Type | Condition |
|---|---|
| ArgumentNullException | The array parameter is a null reference (Nothing in Visual Basic). |
| ArgumentOutOfRangeException | The index parameter is less than zero. |
| ArgumentException | The array parameter is multidimensional.
-or- The index parameter is equal to or greater than the length of array. -or- The number of elements in the source SoapHeaderCollection is greater than the available space from the index parameter to the end of the destination array. |
Example
[Visual Basic] mySoapHeaders = New MySoapHeader(mySoapHeaderCollection.Count-1) {} mySoapHeaderCollection.CopyTo(mySoapHeaders, 0) [C#] mySoapHeaders = new MySoapHeader[mySoapHeaderCollection.Count]; mySoapHeaderCollection.CopyTo(mySoapHeaders, 0); [C++] mySoapHeaders = new MySoapHeader*[mySoapHeaderCollection->Count]; mySoapHeaderCollection->CopyTo(mySoapHeaders, 0);
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
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, .NET Compact Framework
See Also
SoapHeaderCollection Class | SoapHeaderCollection Members | System.Web.Services.Protocols Namespace | CopyTo | ICollection | SoapHeader