IHttpSessionState.CopyTo(Array, Int32) 方法

定义

将会话状态项值的集合复制到一维数组中(从数组的指定索引处开始)。

public:
 void CopyTo(Array ^ array, int index);
public void CopyTo (Array array, int index);
abstract member CopyTo : Array * int -> unit
Public Sub CopyTo (array As Array, index As Integer)

参数

array
Array

Array,它接收会话值。

index
Int32

array 中开始复制的索引。

示例

下面的代码示例实现 CopyTo 接口的 方法, IHttpSessionState 以将会话状态项值复制到数组。

public void CopyTo(Array items, int index)
{
  foreach (object o in items)
    items.SetValue(o, index++);
}
Public Sub CopyTo(items As Array, index As Integer) Implements IHttpSessionState.CopyTo    
  For Each o As Object In items
    items.SetValue(o, index)
    index += 1
  Next
End Sub

适用于

另请参阅