asp.net.ph

HttpStaticObjectsCollection.CopyTo Method

System.Web Namespace   HttpStaticObjectsCollection Class


Copies members of an HttpStaticObjectsCollection into an array.

[ VB ]
NotOverridable Public Sub CopyTo ( _
   ByVal array As Array, _
   ByVal index As Integer _
) Implements ICollection.CopyTo

[ C# ]
public void CopyTo (
   Array array,
   int index
);

[ C++ ]
public: __sealed void CopyTo (
   Array* array,
   int index
);

[ JScript ]
public function CopyTo (
   array : Array,
   index : int
);

Parameters

array
The array to copy the HttpStaticObjectsCollection into.
index
The member of the collection where copying starts.

Implements

ICollection.CopyTo

Example

The following example creates a new Object array of the required size and copies an existing StaticObjects collection into it.

[ VB ]
' Find the number of members in the StaticObjects collection.
Dim ObjCount As Integer = Application.StaticObjects.Count
' Create an array of the same size.
Dim myObjArray As Array = Array.CreateInstance ( Type.GetType ( "System.Object" ) , ObjCount ) 
' Copy the entire collection into the array.
Application.StaticObjects.CopyTo ( myObjArray, 0 )

[ C# ]
// Find the number of members in the StaticObjects collection.
int ObjCount = Application.StaticObjects.Count;
// Create an array of the same size.
Array myObjArray = Array.CreateInstance ( Type.GetType ( "System.Object" ) , ObjCount );
// Copy the entire collection into the array.
Application.StaticObjects.CopyTo ( myObjArray, 0 );
See Also

HttpStaticObjectsCollection Members   HttpApplicationState.StaticObjects Property Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph