SiteMapNode.ToString Yöntem

Tanım

Sınıfının bu örneğinin SiteMapNode değerini eşdeğer dize gösterimine dönüştürür.

public:
 override System::String ^ ToString();
public override string ToString ();
override this.ToString : unit -> string
Public Overrides Function ToString () As String

Döndürülenler

String

Bu SiteMapNodedeğerinin dize gösterimi.

Örnekler

Aşağıdaki kod örneği, yönteminin bir SiteMapNode nesnenin ToString ve Title özellikleriyle Url nasıl karşılaştırılıp karşılaştırılamını gösterir.

<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<SCRIPT runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
    // Navigate the SiteMap built by the default SiteMapProvider.
    Response.Write(SiteMap.RootNode.ToString() + "<BR>");

    Response.Write(SiteMap.RootNode.Url + "<BR>");
    Response.Write(SiteMap.RootNode.Title + "<BR>");

    foreach (SiteMapNode sitemapnode in SiteMap.RootNode.ChildNodes)
    {
        // Iterate through the ChildNodes SiteMapNodesCollection
        // maintained by the RootNode.
        Response.Write(sitemapnode.Url + "<BR>" );
    }

    IEnumerator providers = SiteMap.Providers.GetEnumerator();
    while (providers.MoveNext())
    {
        Response.Write(providers.Current);
        Response.Write("&nbsp;&nbsp;&nbsp;");
        Response.Write("<BR>");
    }
}
</SCRIPT>
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<SCRIPT runat="server">
Private Sub Page_Load(Sender As Object, E As EventArgs)

    ' Navigate the SiteMap built by the default SiteMapProvider.
    Response.Write(SiteMap.RootNode.ToString() & "<BR>")

    Response.Write(SiteMap.RootNode.Url & "<BR>")
    Response.Write(SiteMap.RootNode.Title & "<BR>")

    Dim sitemapnode As SiteMapNode
    For Each sitemapnode In SiteMap.RootNode.ChildNodes
        ' Iterate through the ChildNodes SiteMapNodesCollection
        ' maintained by the RootNode.
        Response.Write(sitemapnode.Url & "<BR>" )
    Next

    Dim providers As IDictionaryEnumerator = SiteMap.Providers.GetEnumerator()
    While (providers.MoveNext())
        Response.Write(providers.Current)
        Response.Write("&nbsp;&nbsp;&nbsp;")
        Response.Write("<BR>")
    End While
End Sub ' Page_Load

</SCRIPT>

Açıklamalar

ToString yöntemi bir SiteMapNode nesnenin Title özelliğini döndürür.

Şunlara uygulanır