SiteMapNodeCollection 생성자
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
SiteMapNodeCollection 클래스의 새 인스턴스를 초기화합니다.
오버로드
| Name | Description |
|---|---|
| SiteMapNodeCollection() |
기본 인스턴스인 클래스의 SiteMapNodeCollection 새 인스턴스를 초기화합니다. |
| SiteMapNodeCollection(Int32) |
지정된 초기 용량을 사용하여 클래스의 SiteMapNodeCollection 새 인스턴스를 초기화합니다. |
| SiteMapNodeCollection(SiteMapNode) |
클래스의 새 인스턴스를 SiteMapNodeCollection 초기화하고 컬렉션의 SiteMapNode 속성에 InnerList 개체를 추가합니다. |
| SiteMapNodeCollection(SiteMapNode[]) |
클래스의 새 인스턴스를 SiteMapNodeCollection 초기화하고 컬렉션의 속성에 InnerList 형식 SiteMapNode 배열을 추가합니다. |
| SiteMapNodeCollection(SiteMapNodeCollection) |
클래스의 새 인스턴스를 SiteMapNodeCollection 초기화하고 지정된 SiteMapNodeCollection 컬렉션의 모든 목록 항목을 컬렉션의 InnerList 속성에 추가합니다. |
SiteMapNodeCollection()
기본 인스턴스인 클래스의 SiteMapNodeCollection 새 인스턴스를 초기화합니다.
public:
SiteMapNodeCollection();
public SiteMapNodeCollection();
Public Sub New ()
예제
다음 코드 예제에서는 생성자를 사용하여 SiteMapNodeCollection 새 SiteMapNodeCollection 컬렉션을 만든 다음 메서드를 사용하여 요소를 SiteMapNodeCollectionAdd 추가하는 방법을 보여 줍니다.
// The LoadSiteMapData() method loads site navigation
// data from persistent storage into a DataTable.
DataTable siteMap = LoadSiteMapData();
// Create a SiteMapNodeCollection.
SiteMapNodeCollection nodes = new SiteMapNodeCollection();
// Create a SiteMapNode and add it to the collection.
SiteMapNode tempNode;
DataRow row;
int index = 0;
while (index < siteMap.Rows.Count)
{
row = siteMap.Rows[index];
// Create a node based on the data in the DataRow.
tempNode = new SiteMapNode(SiteMap.Provider,
row["Key"].ToString(),
row["Url"].ToString());
// Add the node to the collection.
nodes.Add(tempNode);
++index;
}
' The LoadSiteMapData() Function loads site navigation
' data from persistent storage into a DataTable.
Dim siteMapData As DataTable
siteMapData = LoadSiteMapData()
' Create a SiteMapNodeCollection.
Dim nodes As New SiteMapNodeCollection()
' Create a SiteMapNode and add it to the collection.
Dim tempNode As SiteMapNode
Dim row As DataRow
Dim index As Integer
index = 0
While (index < siteMapData.Rows.Count)
row = siteMapData.Rows(index)
' Create a node based on the data in the DataRow.
tempNode = New SiteMapNode(SiteMap.Provider, row("Key").ToString(), row("Url").ToString())
' Add the node to the collection.
nodes.Add(tempNode)
index = index + 1
End While
설명
SiteMapNodeCollection 생성자를 사용하여 빈 SiteMapNodeCollection 컬렉션을 만듭니다. 또는 메서드를 SiteMapNodeCollection 사용하여 AddAddRangeInsert 요소를 추가할 수 있습니다.
추가 정보
적용 대상
SiteMapNodeCollection(Int32)
지정된 초기 용량을 사용하여 클래스의 SiteMapNodeCollection 새 인스턴스를 초기화합니다.
public:
SiteMapNodeCollection(int capacity);
public SiteMapNodeCollection(int capacity);
new System.Web.SiteMapNodeCollection : int -> System.Web.SiteMapNodeCollection
Public Sub New (capacity As Integer)
매개 변수
- capacity
- Int32
의 초기 용량 SiteMapNodeCollection입니다.
설명
SiteMapNodeCollection 생성자를 사용하여 지정된 초기 용량의 SiteMapNodeCollection 컬렉션을 만듭니다.
추가 정보
적용 대상
SiteMapNodeCollection(SiteMapNode)
클래스의 새 인스턴스를 SiteMapNodeCollection 초기화하고 컬렉션의 SiteMapNode 속성에 InnerList 개체를 추가합니다.
public:
SiteMapNodeCollection(System::Web::SiteMapNode ^ value);
public SiteMapNodeCollection(System.Web.SiteMapNode value);
new System.Web.SiteMapNodeCollection : System.Web.SiteMapNode -> System.Web.SiteMapNodeCollection
Public Sub New (value As SiteMapNode)
매개 변수
- value
- SiteMapNode
에 추가할 A SiteMapNode 입니다 SiteMapNodeCollection.
예외
value은 null입니다.
예제
다음 코드 예제에서는 단일 초기 SiteMapNode 개체를 사용 하 여 SiteMapNodeCollection 컬렉션을 만든 다음 메서드를 SiteMapNodeCollection 사용 하 여 AddRange 개체를 SiteMapNode 추가 하는 방법을 보여 줍니다. 개별 SiteMapNode 개체가 SiteMapNodeCollection읽기 전용일 수 있더라도 수정할 수 있습니다.
// Create a SiteMapNodeCollection with all the nodes
// from the first two hierarchical levels of the current
// site map.
SiteMapNodeCollection baseCollection =
new SiteMapNodeCollection(SiteMap.RootNode);
SiteMapNodeCollection childCollection =
SiteMap.RootNode.ChildNodes;
baseCollection.AddRange(childCollection);
Response.Write( "<BR>Derived SiteMapNodeCollection.<BR><HR><BR>");
foreach (SiteMapNode node in baseCollection) {
Response.Write( node.Title + "<BR>");
}
' Create a SiteMapNodeCollection with all the nodes
' from the first two hierarchical levels of the current
' site map.
Dim baseCollection As SiteMapNodeCollection
baseCollection = New SiteMapNodeCollection(SiteMap.RootNode)
Dim childCollection As SiteMapNodeCollection = SiteMap.RootNode.ChildNodes
baseCollection.AddRange(childCollection)
Response.Write( "<BR>Derived SiteMapNodeCollection.<BR><HR><BR>")
For Each node In baseCollection
Response.Write( node.Title + "<BR>")
Next
설명
SiteMapNodeCollection 생성자를 사용하여 단일 초기 SiteMapNode 개체를 사용하여 SiteMapNodeCollection 컬렉션을 만듭니다. 또는 메서드를 SiteMapNodeCollection 사용하여 AddAddRangeInsert 요소를 추가할 수 있습니다.
추가 정보
적용 대상
SiteMapNodeCollection(SiteMapNode[])
클래스의 새 인스턴스를 SiteMapNodeCollection 초기화하고 컬렉션의 속성에 InnerList 형식 SiteMapNode 배열을 추가합니다.
public:
SiteMapNodeCollection(cli::array <System::Web::SiteMapNode ^> ^ value);
public SiteMapNodeCollection(System.Web.SiteMapNode[] value);
new System.Web.SiteMapNodeCollection : System.Web.SiteMapNode[] -> System.Web.SiteMapNodeCollection
Public Sub New (value As SiteMapNode())
매개 변수
- value
- SiteMapNode[]
에 추가할 형식 SiteMapNode 의 배열입니다 SiteMapNodeCollection.
예외
value은 null입니다.
설명
SiteMapNodeCollection 생성자를 사용하는 것은 생성자를 호출 SiteMapNodeCollection 하고 메서드를 사용하여 컬렉션 AddRange 에 SiteMapNodeCollection 요소를 추가하는 것과 같습니다.
추가 정보
적용 대상
SiteMapNodeCollection(SiteMapNodeCollection)
클래스의 새 인스턴스를 SiteMapNodeCollection 초기화하고 지정된 SiteMapNodeCollection 컬렉션의 모든 목록 항목을 컬렉션의 InnerList 속성에 추가합니다.
public:
SiteMapNodeCollection(System::Web::SiteMapNodeCollection ^ value);
public SiteMapNodeCollection(System.Web.SiteMapNodeCollection value);
new System.Web.SiteMapNodeCollection : System.Web.SiteMapNodeCollection -> System.Web.SiteMapNodeCollection
Public Sub New (value As SiteMapNodeCollection)
매개 변수
- value
- SiteMapNodeCollection
현재SiteMapNodeCollection에 SiteMapNode 추가할 항목이 들어 있는 A SiteMapNodeCollection 입니다.
예외
value은 null입니다.
예제
다음 코드 예제에서는 다른 SiteMapNodeCollectionSiteMapNode 개체를 SiteMapNodeCollection 기본으로 사용하여 컬렉션을 만드는 방법을 보여 줍니다. 메서드는 SiteMapNode.GetAllNodes 속성이 반환될 때 검색되는 읽기 전용 SiteMapNodeCollection을 IsReadOnly 반환합니다 true. 새 SiteMapNodeCollection 항목은 읽기 전용 SiteMapNodeCollection 을 사용하여 만들어지고 메서드와 Remove 메서드를 Add 성공적으로 호출할 수 있습니다.
SiteMapNodeCollection siteNodes = SiteMap.RootNode.GetAllNodes();
if ( siteNodes.IsReadOnly ||
siteNodes.IsFixedSize )
{
Response.Write("Collection is read-only or has fixed size.<BR>");
// Create a new, modifiable collection from the existing one.
SiteMapNodeCollection modifiableCollection =
new SiteMapNodeCollection(siteNodes);
// The MoveNode example method moves a node from position one to
// the last position in the collection.
MoveNode(modifiableCollection);
}
else {
MoveNode(siteNodes);
}
Dim siteNodes As SiteMapNodeCollection
siteNodes = SiteMap.RootNode.GetAllNodes()
If siteNodes.IsReadOnly Or siteNodes.IsFixedSize Then
Response.Write("Collection is read-only or has fixed size.<BR>")
' Create a new, modifiable collection from the existing one.
Dim modifiableCollection As SiteMapNodeCollection
modifiableCollection = New SiteMapNodeCollection(siteNodes)
' The MoveNode example method moves a node from position one to
' the last position in the collection.
MoveNode(modifiableCollection)
Else
MoveNode(siteNodes)
End If
설명
SiteMapNodeCollection 생성자를 사용하는 것은 생성자를 호출 SiteMapNodeCollection 하고 메서드를 사용하여 컬렉션 AddRange 에 SiteMapNodeCollection 요소를 추가하는 것과 같습니다.