2012-06-18 13 views

答えて

13

は、この単純なかみそりマクロは、あなたが望むものを達成する必要があります

@{ 
    // Get root node: 
    var root = Model.AncestorOrSelf(); 

    // Get all descendants, filter by type: 
    var nodes = root.Descendants("info"); 

    // Loop through the filtered nodes, displaying the properties: 
    <ul> 
    @foreach (var node in nodes) 
    { 
     <li> 
      <h2>@node.infoTitle</h2> 
      <div>@node.infoSummary</div> 
      <div>@node.infoBody</div> 
     </li> 
    } 
    </ul> 
} 
関連する問題