WizardStepCollection.CopyTo(WizardStepBase[], Int32) 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
컬렉션의 모든 항목을 WizardStepCollection 대상 배열의 WizardStepBase 지정된 인덱스에서 시작하여 호환되는 1차원 개체 배열로 복사합니다.
public:
void CopyTo(cli::array <System::Web::UI::WebControls::WizardStepBase ^> ^ array, int index);
public void CopyTo(System.Web.UI.WebControls.WizardStepBase[] array, int index);
member this.CopyTo : System.Web.UI.WebControls.WizardStepBase[] * int -> unit
Public Sub CopyTo (array As WizardStepBase(), index As Integer)
매개 변수
- array
- WizardStepBase[]
컬렉션에서 복사한 항목을 받는 개체의 WizardStepBase 배열(0부터 시작)입니다.
- index
- Int32
배열이 복사된 항목을 받기 시작하는 대상 배열의 위치입니다.
예제
다음 예제에서는 컬렉션에서 배열로 개체를 WizardStepBase 복사 하는 메서드를 사용 CopyTo 하는 방법을 보여 줍니다. 그런 다음 배열을 반복하여 각 WizardStepBase파생 개체의 속성을 표시 ID 합니다. 예제 WizardSteps 에서 컨트롤의 Wizard 속성은 클래스의 WizardStepCollection 인스턴스입니다.
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
void Page_Load(Object sender, EventArgs e)
{
// Declare an array of WizardStepBase objects.
WizardStepBase[] stepArray = new WizardStepBase[Wizard1.WizardSteps.Count];
// Use the CopyTo method to copy the WizardStep items
// of the Wizard control into the array.
Wizard1.WizardSteps.CopyTo(stepArray, 0);
// Display the WizardStep items.
Message.Text = "The WizardStepBase items of the Wizard1 control are: <br/><br/>";
for (int i = 0; i < stepArray.Length; i++)
{
Message.Text += stepArray[i].ID + "<br />";
}
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>ASP.NET Example</title>
</head>
<body>
<form id="form1" runat="server">
<asp:Wizard id="Wizard1"
runat="server" >
<WizardSteps>
<asp:WizardStep id="WizardStep1"
runat="server"
title="Step 1">
</asp:WizardStep>
<asp:WizardStep id="WizardStep2"
runat="server"
title="Step 2">
</asp:WizardStep>
<asp:WizardStep id="WizardStep3"
runat="server"
title="Step 3">
</asp:WizardStep>
</WizardSteps>
<HeaderTemplate>
<b>WizardStepCollection CopyTo Example</b>
</HeaderTemplate>
</asp:Wizard>
<asp:label id="Message"
runat="server"/>
</form>
</body>
</html>
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
' Declare an array of WizardStepBase objects.
Dim stepArray(Wizard1.WizardSteps.Count - 1) As WizardStep
' Use the CopyTo method to copy the WizardStep items
' of the Wizard control into the array.
Wizard1.WizardSteps.CopyTo(stepArray, 0)
' Display the WizardStep items.
Message.Text = "The WizardStepBase items of the Wizard1 control are: <br/><br/>"
For i As Integer = 0 To stepArray.Length - 1
Message.Text &= stepArray(i).ID & "<br />"
Next
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>ASP.NET Example</title>
</head>
<body>
<form id="form1" runat="server">
<asp:Wizard id="Wizard1"
runat="server" >
<WizardSteps>
<asp:WizardStep id="WizardStep1"
runat="server"
title="Step 1">
</asp:WizardStep>
<asp:WizardStep id="WizardStep2"
runat="server"
title="Step 2">
</asp:WizardStep>
<asp:WizardStep id="WizardStep3"
runat="server"
title="Step 3">
</asp:WizardStep>
</WizardSteps>
<HeaderTemplate>
<b>WizardStepCollection CopyTo Example</b>
</HeaderTemplate>
</asp:Wizard>
<asp:label id="Message"
runat="server"/>
</form>
</body>
</html>
설명
이 메서드를 CopyTo 사용하여 컬렉션의 내용을 지정된 0부터 시작하는 배열로 복사합니다. 항목은 대상 배열의 지정된 인덱스에서 시작하여 복사됩니다. 항목이 배열에 있으면 배열 구문을 사용하여 컬렉션의 항목에 WizardStepCollection 액세스할 수 있습니다.
또는 이 메서드를 사용하여 컬렉션의 GetEnumerator 항목에 액세스하는 데 사용할 수 있는 열거자를 만들 수도 있습니다.