本文整理匯總了C#中umbraco.NodeFactory.Node.FirstOrDefault方法的典型用法代碼示例。如果您正苦於以下問題:C# Node.FirstOrDefault方法的具體用法?C# Node.FirstOrDefault怎麽用?C# Node.FirstOrDefault使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類umbraco.NodeFactory.Node
的用法示例。
在下文中一共展示了Node.FirstOrDefault方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ReturnTopicStarterPost_NodeFactory
/// <summary>
/// Returns the post that started the topic
/// </summary>
/// <param name="topicNodeId"></param>
/// <returns></returns>
public ForumPost ReturnTopicStarterPost_NodeFactory(int topicNodeId)
{
var posts = new Node(topicNodeId).ChildrenAsList.Where(x => x.NodeTypeAlias == NodeTypePost && x.GetProperty("forumPostIsTopicStarter").Value == "1");
return Mapper.MapForumPost(posts.FirstOrDefault());
}
示例2: ReturnLatestPostInTopic_NodeFactory
/// <summary>
/// Returns the latest post in a topic
/// </summary>
/// <param name="topicNodeId"></param>
/// <returns></returns>
public ForumPost ReturnLatestPostInTopic_NodeFactory(int topicNodeId)
{
var posts = new Node(topicNodeId).ChildrenAsList.Where(x => x.NodeTypeAlias == NodeTypePost).OrderByDescending(x => x.CreateDate);
return Mapper.MapForumPost(posts.FirstOrDefault());
}