EntitySet<TEntity>.CopyTo(TEntity[], Int32) Method

Definition

Copies the EntitySet<TEntity> to an array.

C#
public void CopyTo(TEntity[] array, int arrayIndex);

Parameters

array
TEntity[]

The array to copy to.

arrayIndex
Int32

The starting index in the array.

Implements

Examples

The following example shows one use of this method:

C#
var customer = (from c in db.Customers  
   where c.CustomerID == "ALFKI"  
   select c).Single();

var orderArray = new Order[customer.Orders.Count];
customer.Orders.CopyTo(orderArray,0);

Applies to

Product Versions
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1