SiteMapNodeCollection.Remove(SiteMapNode) 메서드

정의

컬렉션에서 지정된 SiteMapNode 개체를 제거합니다.

public:
 virtual void Remove(System::Web::SiteMapNode ^ value);
public virtual void Remove (System.Web.SiteMapNode value);
abstract member Remove : System.Web.SiteMapNode -> unit
override this.Remove : System.Web.SiteMapNode -> unit
Public Overridable Sub Remove (value As SiteMapNode)

매개 변수

value
SiteMapNode

SiteMapNode에서 제거할 SiteMapNodeCollection입니다.

예외

value이 컬렉션에 없습니다.

value이(가) null인 경우

SiteMapNodeCollection이 읽기 전용인 경우

또는 SiteMapNodeCollection가 고정 크기입니다.

예제

다음 코드 예제에 사용 하는 방법을 보여 줍니다.는 Remove 제거 하는 방법을 SiteMapNode 에서 개체를 SiteMapNodeCollection 컬렉션 추가 SiteMapNode 개체의 끝에는 SiteMapNodeCollection 를 사용 하 여를 Add 메서드. 경우는 SiteMapNodeCollection 는 읽기 전용 이며는 NotSupportedException 예외가 검색 되었습니다.


// 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

설명

테스트할 수 있는지 여부를 SiteMapNodeCollection 컬렉션 읽기 전용인 지 확인 하 여를 IsReadOnly 속성.

합니다 Remove 메서드를 호출 하 여 일치 여부를 확인 합니다 Object.Equals 메서드.

적용 대상

추가 정보