SiteMapNodeCollection 생성자

정의

SiteMapNodeCollection 클래스의 새 인스턴스를 초기화합니다.

오버로드

SiteMapNodeCollection()

기본 인스턴스인 SiteMapNodeCollection 클래스의 새 인스턴스를 초기화합니다.

SiteMapNodeCollection(Int32)

지정된 초기 용량을 사용하여 SiteMapNodeCollection 클래스의 새 인스턴스를 초기화합니다.

SiteMapNodeCollection(SiteMapNode)

SiteMapNodeCollection 클래스의 새 인스턴스를 초기화하고 컬렉션의 SiteMapNode 속성에 InnerList 개체를 추가합니다.

SiteMapNodeCollection(SiteMapNode[])

SiteMapNodeCollection 클래스의 새 인스턴스를 초기화하고 컬렉션의 SiteMapNode 속성에 InnerList 형식의 배열을 추가합니다.

SiteMapNodeCollection(SiteMapNodeCollection)

SiteMapNodeCollection 클래스의 새 인스턴스를 초기화하고 컬렉션의 SiteMapNodeCollection 속성에 지정된 InnerList 컬렉션의 모든 목록 항목을 추가합니다.

SiteMapNodeCollection()

기본 인스턴스인 SiteMapNodeCollection 클래스의 새 인스턴스를 초기화합니다.

public:
 SiteMapNodeCollection();
public SiteMapNodeCollection ();
Public Sub New ()

예제

다음 코드 예제에 사용 하는 방법을 보여 줍니다.는 SiteMapNodeCollection 새 생성자 SiteMapNodeCollection 컬렉션 폴더를 추가한 다음 요소를 사용 하는 SiteMapNodeCollection 사용 하 여는 Add 메서드.

// 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 를 사용 하는 Add, AddRange, 또는 Insert 메서드.

추가 정보

적용 대상

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

SiteMapNode 에 추가할 SiteMapNodeCollection입니다.

예외

value이(가) null인 경우

예제

다음 코드 예제에는 만드는 방법을 보여 줍니다는 SiteMapNodeCollection 단일 초기를 사용 하 여 컬렉션 SiteMapNode 개체를 추가한 다음는 SiteMapNodeCollectionSiteMapNode 사용 하 여 개체를 AddRange 메서드. 수정할 수는 SiteMapNodeCollection경우에 개별 SiteMapNode 개체는 읽기 전용일 수 있습니다.


// 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 만들려면 생성자를 SiteMapNodeCollection 단일 초기를 사용 하 여 컬렉션 SiteMapNode 개체입니다. 요소를 추가할 수 있습니다는 SiteMapNodeCollection 를 사용 하는 Add, AddRange, 또는 Insert 메서드.

추가 정보

적용 대상

SiteMapNodeCollection(SiteMapNode[])

SiteMapNodeCollection 클래스의 새 인스턴스를 초기화하고 컬렉션의 SiteMapNode 속성에 InnerList 형식의 배열을 추가합니다.

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 생성자 및 요소를 추가 합니다 SiteMapNodeCollection 사용 하 여 컬렉션은 AddRange 메서드.

추가 정보

적용 대상

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가 들어 있는 SiteMapNodeCollection입니다.

예외

value이(가) null인 경우

예제

다음 코드 예제에서는 만드는 방법을 보여 줍니다.는 SiteMapNodeCollection 다른를 사용 하 여 컬렉션 SiteMapNodeCollectionSiteMapNode 개체를 기준으로 합니다. 합니다 SiteMapNode.GetAllNodes 메서드는 읽기 전용 SiteMapNodeCollection는 때 검색 되는 IsReadOnly 속성에서 반환 true합니다. 새 SiteMapNodeCollection 읽기 전용을 사용 하 여 만들어집니다 SiteMapNodeCollection 하며 AddRemove 메서드를 성공적으로 호출할 수 있습니다.

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 생성자 및 요소를 추가 합니다 SiteMapNodeCollection 사용 하 여 컬렉션은 AddRange 메서드.

적용 대상