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


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

本文整理汇总了C#中System.Collections.Generic.Skip方法的典型用法代码示例。如果您正苦于以下问题:C# System.Collections.Generic.Skip方法的具体用法?C# System.Collections.Generic.Skip怎么用?C# System.Collections.Generic.Skip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Collections.Generic的用法示例。


在下文中一共展示了System.Collections.Generic.Skip方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ExistingUser

        public void ExistingUser()
        {
            // Arrange
            IEnumerable<User> users = new[]
            {
                new User {Id = 1, FirstName = "User1", LastName = "User1", Email = "[email protected]", IsActive = true},
                new User {Id = 2, FirstName = "User2", LastName = "User2", Email = "[email protected]", IsActive = true},
                new User {Id = 3, FirstName = "User3", LastName = "User3", Email = "[email protected]", IsActive = true}
            };

            ApplicationDbContext dbContext = new Mock<ApplicationDbContext>("Test")
                .SetupDbContextData(x => x.Users, users)
                .Build();

            // Act
            User userToSearch = users.Skip(1).First();

            UserByEmailQuery query = new UserByEmailQuery(dbContext);
            User result = query.Execute(userToSearch.Email);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(userToSearch.Id, result.Id);
            Assert.AreEqual(userToSearch.FirstName, result.FirstName);
            Assert.AreEqual(userToSearch.LastName, result.LastName);
            Assert.AreEqual(userToSearch.Email, result.Email);
            Assert.AreEqual(userToSearch.IsActive, result.IsActive);
        }
开发者ID:Code-First,项目名称:CQS-Sample,代码行数:28,代码来源:UserByEmailQueryTests.cs

示例2: ToVAPoints

        public static IList<VA.Drawing.Point> ToVAPoints(MG.Edge edge)
        {
            var final_bez_points = new List<VA.Drawing.Point> { ToVAPoint(edge.Curve.Start) };

            var curve = (MG.Splines.Curve) edge.Curve;

            foreach (var cur_seg in curve.Segments)
            {
                if (cur_seg is MG.Splines.CubicBezierSegment)
                {
                    var bezier_seg = (MG.Splines.CubicBezierSegment) cur_seg;

                    var bez_points =
                        new[] { 0, 1, 2, 3 }
                            .Select(bezier_seg.B)
                            .Select(ToVAPoint)
                            .ToArray();

                    final_bez_points.AddRange(bez_points.Skip(1));
                }
                else if (cur_seg is MG.Splines.LineSegment)
                {
                    var line_seg = (MG.Splines.LineSegment) cur_seg;
                    final_bez_points.Add(ToVAPoint(line_seg.Start));
                    final_bez_points.Add(ToVAPoint(line_seg.End));
                    final_bez_points.Add(ToVAPoint(line_seg.End));
                }
                else
                {
                    throw new System.InvalidOperationException("Unsupported Curve Segment type");
                }
            }

            return final_bez_points;
        }
开发者ID:firestream99,项目名称:VisioAutomation,代码行数:35,代码来源:MSAGLUtil.cs

示例3: Generate

        public static Solution Generate(Project mainProject, bool generateEntryProject, string outputPath, IEnumerable<Project> additionalProjects)
        {
            var projects = 
                new[] { mainProject }.Union(
                mainProject.GetAllReferences()
                .Union(additionalProjects.SelectMany(x => x.GetAllReferences()))
                .Union(additionalProjects)).ToList();

            if(generateEntryProject)
            {
                var motherProject = Project.CreateEntryProject(mainProject, outputPath, projects.Skip(1));
                projects.Insert(0, motherProject);
            }

            return new Solution(projects);
        }   
开发者ID:rte-se,项目名称:emul8,代码行数:16,代码来源:SolutionGenerator.cs

示例4: should_skip_first_n_elements_using_skip

        public void should_skip_first_n_elements_using_skip()
        {
            var sequence = new[] {1, 2, 3, 4, 5};

            IEnumerable<int> filteredElements = sequence.Skip(3);

            // please update variable value to fix the test.
            IEnumerable<int> expectedResult = new[] {1, 2, 3, 4, 5};

            Assert.Equal(expectedResult, filteredElements);
        }
开发者ID:chenbojian,项目名称:01_NewbieVillage,代码行数:11,代码来源:24_LinqBasics.cs


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