本文整理汇总了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);
}
示例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;
}
示例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);
}
示例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);
}