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 가 컬렉션에 없습니다.

valuenull입니다.

읽기 SiteMapNodeCollection 전용입니다.

-또는-

크기가 SiteMapNodeCollection 고정되어 있습니다.

예제

다음 코드 예제에서는 메서드를 사용 하 여 Remove 컬렉션에서 SiteMapNodeCollection 개체를 제거 하 SiteMapNode 고 메서드를 사용 하 여 Add 끝에 SiteMapNodeCollection 개체를 추가 SiteMapNode 하는 방법을 보여 줍니다. SiteMapNodeCollection 읽기 전용인 경우 예외가 NotSupportedException catch됩니다.


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

적용 대상

추가 정보