This documentation is archived and is not being maintained.
HttpFileCollection.CopyTo Method
.NET Framework 1.1
Copies members of the file collection to an Array beginning at the specified index of the array.
[Visual Basic] Public Sub CopyTo( _ ByVal dest As Array, _ ByVal index As Integer _ ) [C#] public void CopyTo( Array dest, int index ); [C++] public: void CopyTo( Array* dest, int index ); [JScript] public function CopyTo( dest : Array, index : int );
Parameters
- dest
- The destination Array.
- index
- The index of the destination array where copying starts.
Example
The following example copies the entire file collection into a new Array object.
[Visual Basic] ' Create the one-dimensional target array. ' Dimension it large enough to hold the files collection. Dim MyArray As Array = Array.CreateInstance(GetType(String), Request.Files.Count) ' Copy the entire collection to the array. Request.Files.CopyTo(MyArray, 0) [C#] // Create the one-dimensional target array. // Dimension it large enough to hold the files collection. Array MyArray = Array.CreateInstance( typeof(String), Request.Files.Count ); // Copy the entire collection to the array. Request.Files.CopyTo( MyArray, 0 ); [C++] // Create the one-dimensional target array. // Dimension it large enough to hold the files collection. Array* MyArray = Array::CreateInstance( __typeof(String), Request->Files->Count ); // Copy the entire collection to the array. Request->Files->CopyTo( MyArray, 0 ); [JScript] // Create the one-dimensional target Array. // Dimension it large enough to hold the files collection. var myArray : System.Array = System.Array.CreateInstance(System.String, Request.Files.Count) // Copy the entire files collection to the array. Request.Files.CopyTo(myArray, 0)
Requirements
Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family
See Also
HttpFileCollection Class | HttpFileCollection Members | System.Web Namespace
Show: