SiteMapNodeCollection.Item[Int32] 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
컬렉션의 SiteMapNode 지정된 인덱스에서 개체를 가져오거나 설정합니다.
public:
virtual property System::Web::SiteMapNode ^ default[int] { System::Web::SiteMapNode ^ get(int index); void set(int index, System::Web::SiteMapNode ^ value); };
public virtual System.Web.SiteMapNode this[int index] { get; set; }
member this.Item(int) : System.Web.SiteMapNode with get, set
Default Public Overridable Property Item(index As Integer) As SiteMapNode
매개 변수
- index
- Int32
찾을 인 SiteMapNode 덱스입니다.
속성 값
의 요소를 SiteMapNode나타내는 A SiteMapNodeCollection 입니다.
예외
읽기 SiteMapNodeCollection 전용입니다.
setter에 제공된 값은 .입니다 null.
예제
다음 코드 예제에서는 인덱서 컬렉션에서 Item[] 개체를 SiteMapNode 검색 하는 방법을 보여 SiteMapNodeCollection 줍니다. 이 예제에서는 메서드를 SiteMapNode 사용하여 Remove 내부 배열의 두 번째 요소에서 개체가 해당 위치에서 제거되고 메서드와 함께 배열에 Add 추가됩니다. 특정 인덱스에서 개체를 SiteMapNode 삽입하려면 배열의 끝에 개체를 추가하는 대신 메서드를 Insert 사용합니다.
// Move a node from one spot in the list to another.
try {
Response.Write("Original node order: <BR>");
foreach (SiteMapNode node in nodes) {
Response.Write( node.Title + "<BR>");
}
SiteMapNode aNode = nodes[1];
Response.Write("Adding " + aNode.Title + " to the end of the collection.<BR>");
nodes.Add(aNode);
Response.Write("Removing " + aNode.Title + " at position 1. <BR>");
nodes.Remove(nodes[1]);
Response.Write("New node order: <BR>");
foreach (SiteMapNode node in nodes) {
Response.Write( node.Title + "<BR>");
}
}
catch (NotSupportedException nse) {
Response.Write("NotSupportedException caught.<BR>");
}
' Move a node from one spot in the list to another.
Try
Response.Write("Original node order: <BR>")
Dim node As SiteMapNode
For Each node In nodes
Response.Write( node.Title & "<BR>")
Next
Dim aNode As SiteMapNode = nodes(1)
Response.Write("Adding " & aNode.Title & " to the end of the collection.<BR>")
nodes.Add(aNode)
Response.Write("Removing " & aNode.Title & " at position 1. <BR>")
nodes.Remove(nodes(1))
Response.Write("New node order: <BR>")
For Each node In nodes
Response.Write( node.Title & "<BR>")
Next
Catch nse As NotSupportedException
Response.Write("NotSupportedException caught.<BR>")
End Try
설명
인덱서로 Item[] 컬렉션의 SiteMapNodeCollection 내용을 반복하거나 지정된 인덱스에서 개체를 SiteMapNode 바꿀 수 있습니다.