RoleProviderCollection.CopyTo(RoleProvider[], Int32) Method

Definition

Copies the role provider collection to a one-dimensional array.

public:
 void CopyTo(cli::array <System::Web::Security::RoleProvider ^> ^ array, int index);
public void CopyTo (System.Web.Security.RoleProvider[] array, int index);
override this.CopyTo : System.Web.Security.RoleProvider[] * int -> unit
Public Sub CopyTo (array As RoleProvider(), index As Integer)

Parameters

array
RoleProvider[]

A one-dimensional Array that is the destination of the elements copied from the RoleProviderCollection. The array must have zero-based indexing.

index
Int32

The zero-based index in array at which copying begins.

Examples

The following code example uses the CopyTo method to copy the contents of a RoleProviderCollection to an array of RoleProvider objects.

RoleProviderCollection providers = Roles.Providers;
RoleProvider[] copiedProviders = new RoleProvider[providers.Count];
providers.CopyTo(copiedProviders, 0);
Dim providers As RoleProviderCollection = Roles.Providers
Dim copiedProviders(providers.Count) As RoleProvider
providers.CopyTo(copiedProviders, 0)

Remarks

This method uses ArrayList.CopyTo to copy role provider objects to the specified array.

Applies to

See also