IHierarchyData.Item プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > IHierarchyData.Item プロパティの意味・解説 

IHierarchyData.Item プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

IHierarchyData オブジェクトが表す階層データ ノード取得します

名前空間: System.Web.UI
アセンブリ: System.Web (system.web.dll 内)
構文構文

解説解説
使用例使用例

IHierarchyData プロパティアクセスし、Type プロパティ使用して IHierarchyData オブジェクトの型をチェックし、そのオブジェクトキャストして、より厳密に指定される操作実行する方法次のコード例示します。このコード例IHierarchyData インターフェイストピック取り上げているコード例一部分です。

' Print out the the current data node, then iterate through its
' children and do the same.

Private Sub PrintFullChildNodeInfo(ByVal
 node As IHierarchyData)
    Dim whitespace As String
 = "     "
    Dim br As String = "<BR>"

    Response.Write(Convert.ToString(node) & br)
    Response.Write(whitespace & node.Path & br)

    ' Check for specific types and perform extended functions.
    If node.Type = "SiteMapNode"
 Then
        ' Because SiteMapNode implements the IHierarchyData interface
,
        ' the IHierarchyData object can be cast directly as a SiteMapNode
,
        ' rather than accessing the Item property for the object that
        ' the Type property identifies.
        Dim siteNode As SiteMapNode = CType(node.Item,
 SiteMapNode)
        Response.Write(whitespace & siteNode.Url & br)
        Response.Write(whitespace & siteNode.Description & br)

    ElseIf node.Type = "SomeBusinessObject
 Then" Then
        ' If the IHierarchyData instance is a wrapper class on a business
        ' object of some kind, you can retrieve the business object
 by using
        ' the IHierarchyData.Item property.
        '          SomeBusinessObject busObj = node.Item as SomeBusinessObject;
    End If

    If node.HasChildren Then
        Dim children As IEnumerator = CType(node.GetChildren().GetEnumerator(),
 IHierarchicalEnumerable)
        While children.MoveNext()
            ' Print out SiteMapNode Titles recursively.
            Dim hierarchicalNode As IHierarchyData
 = node.GetChildren().GetHierarchyData(children.Current)
            PrintFullChildNodeInfo(hierarchicalNode)
        End While
    End If
End Sub
// Print out the the current data node, then iterate through its
// children and do the same.
private void PrintFullChildNodeInfo(IHierarchyData
 node)
{
    string whitespace = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
    string br = "<BR>";

    Response.Write(node.ToString() + br);
    Response.Write(whitespace + node.Path + br);

    // Check for specific types and perform extended functions.
    if (node.Type == "SiteMapNode")
    {
        // Because SiteMapNode implements the IHierarchyData interface
,
        // the IHierarchyData object can be cast directly as a SiteMapNode
,
        // rather than accessing the Item property for the object that
        // the Type property identifies.
        SiteMapNode siteNode = node.Item as SiteMapNode;
        Response.Write(whitespace + siteNode.Url + br);
        Response.Write(whitespace + siteNode.Description + br);
    }
    else if (node.Type == "SomeBusinessObject")
    {
        // If the IHierarchyData instance is a wrapper class on a business
        // object of some kind, you can retrieve the business object
 by using
        // the IHierarchyData.Item property.
        //          SomeBusinessObject busObj = node.Item as SomeBusinessObject;
    }

    if (node.HasChildren)
    {
        IEnumerator children = ((IHierarchicalEnumerable)node.GetChildren()).GetEnumerator();

        while (children.MoveNext())
        {
            // Print out SiteMapNode Titles recursively.
            IHierarchyData hierarchicalNode = node.GetChildren().GetHierarchyData(children.Current);
            PrintFullChildNodeInfo(hierarchicalNode);
        }
    }
}
// Print out the the current data node, then iterate through its
// children and do the same.
private void PrintFullChildNodeInfo(IHierarchyData
 node)
{
    String whitespace = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
    String br = "<BR>";

    get_Response().Write(node.toString() + br);
    get_Response().Write(whitespace + node.get_Path() + br);

    // Check for specific types and perform extended functions.
    if (node.get_Type().Equals("SiteMapNode")) {
        // Because SiteMapNode implements the IHierarchyData interface
,
        // the IHierarchyData object can be cast directly as a SiteMapNode
,
        // rather than accessing the Item property for the object that
        // the Type property identifies.
        SiteMapNode siteNode = null;

        siteNode = (SiteMapNode)node.get_Item();
        get_Response().Write(whitespace + siteNode.get_Url() + br);
        get_Response().Write(whitespace + siteNode.get_Description() + br);
    }
    else {
        if (node.get_Type().Equals("SomeBusinessObject"))
 {
            // If the IHierarchyData instance is a wrapper class on
 a
            // business object of some kind, you can retrieve the business
            // object by using the IHierarchyData.Item property.
            // SomeBusinessObject busObj = node.Item as SomeBusinessObject;
        }
    }
    if (node.get_HasChildren()) {
        IEnumerator children = 
            ((IHierarchicalEnumerable)node.GetChildren()).GetEnumerator();

        while (children.MoveNext()) {
            // Print out SiteMapNode Titles recursively.
            IHierarchyData hierarchicalNode = 
                node.GetChildren().GetHierarchyData(children.get_Current());
            PrintFullChildNodeInfo(hierarchicalNode);
        }
    }
}//PrintFullChildNodeInfo
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
IHierarchyData インターフェイス
IHierarchyData メンバ
System.Web.UI 名前空間
Type



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「IHierarchyData.Item プロパティ」の関連用語

IHierarchyData.Item プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



IHierarchyData.Item プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS