当前位置: 首页>>代码示例>>C#>>正文


C# System.Collections.Generic.List.AsQueryable方法代码示例

本文整理汇总了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]);
        }
开发者ID:somlea-george,项目名称:sutekishop,代码行数:27,代码来源:StockItemServiceTests.cs

示例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);
        }
开发者ID:dkempner,项目名称:voat,代码行数:13,代码来源:CommentBucketViewModel.cs


注:本文中的System.Collections.Generic.System.Collections.Generic.List.AsQueryable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。