本文整理汇总了C#中System.Collections.Generic.System.Collections.Generic.List.AsQueryable方法的典型用法代码示例。如果您正苦于以下问题:C# System.Collections.Generic.List.AsQueryable方法的具体用法?C# System.Collections.Generic.List.AsQueryable怎么用?C# System.Collections.Generic.List.AsQueryable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.Generic.System.Collections.Generic.List
的用法示例。
在下文中一共展示了System.Collections.Generic.List.AsQueryable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetAllForProduct_should_return_active_stockItems_for_product
public void GetAllForProduct_should_return_active_stockItems_for_product()
{
Func<int, string, string, StockItem> createStockItem = (id, size, product) =>
StockItem.Create(product, size, new DateTime(2011, 2, 20), "[email protected]").SetId(id);
var stockItems = new System.Collections.Generic.List<StockItem>
{
createStockItem(1, "-", "Widget"),
createStockItem(2, "Error", "Widget"),
createStockItem(3, "s", "Widget"),
createStockItem(4, "m", "Widget"),
createStockItem(5, "l", "Widget"),
createStockItem(6, "-", "Gadget"),
createStockItem(7, "Large", "Gadget"),
};
stockItems[0].Deactivate(new DateTime(2011, 2, 20), "mike");
stockItems[1].Deactivate(new DateTime(2011, 2, 20), "mike");
stockItemRepository.GetAllDelegate = () => stockItems.AsQueryable();
var returnedItems = stockItemService.GetAllForProduct("Widget");
returnedItems.Count().ShouldEqual(3);
returnedItems.First().ShouldBeTheSameAs(stockItems[2]);
returnedItems.Last().ShouldBeTheSameAs(stockItems[4]);
}
示例2: CommentBucketViewModel
public CommentBucketViewModel(Comment comment)
: this()
{
//Convert object to known type so we can REUSE SOME CODE maybe - if God loves us.
var singleComment = Map(comment);
var commentTree = new System.Collections.Generic.List<usp_CommentTree_Result> { singleComment };
DisplayTree = commentTree.AsQueryable();
CommentTree = commentTree;
Submission = DataCache.Submission.Retrieve(comment.MessageId);
Subverse = DataCache.Subverse.Retrieve(Submission.Subverse);
}