本文整理汇总了C#中System.Linq.Add方法的典型用法代码示例。如果您正苦于以下问题:C# System.Linq.Add方法的具体用法?C# System.Linq.Add怎么用?C# System.Linq.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Linq
的用法示例。
在下文中一共展示了System.Linq.Add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestUseCase
public static void TestUseCase(Assert assert)
{
assert.Expect(1);
var list = new[] { new { LastName = "", FirstName = "", } }.Skip(1).ToList();
list.Add(new
{
LastName = "Ruth",
FirstName = "Babe",
});
list.Add(new
{
LastName = "Johnson",
FirstName = "Walter",
});
list.Add(new
{
LastName = "Cobb",
FirstName = "Ty",
});
list.Add(new
{
LastName = "Schmidt",
FirstName = "Mike",
});
var query = from p in list
where p.LastName.Length == 4
select new
{
p.LastName,
p.FirstName,
};
var s = JSON.Stringify(query.ToList());
assert.Equal(s, "{\"items\":[{\"lastName\":\"Ruth\",\"firstName\":\"Babe\"},{\"lastName\":\"Cobb\",\"firstName\":\"Ty\"}]}", "#485");
}
示例2: OutputGameState
private void OutputGameState(Game game)
{
Csl.Header(string.Format("Game state {0}, next to move is {1}", game.States.Count, game.GetActivePlayer().Name));
Csl.StartTable(18, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 10);
var headers = new[] {"Player"}.Concat(Enumerable.Range(1, 8).Select(x => x.ToString())).Concat(new [] { "Sum" });
Csl.TableHead(headers.ToArray());
var white = new[] {game.White.Name}.Concat(game.GetCurrentState().WhiteCells.Select(x => (x is Die) ? ((Die) x).Value.ToString() : "." )).ToList();
white.Add(game.GetCurrentState().WhiteCells.OfType<Die>().Sum(x => x.Value).ToString());
Csl.TableRow(white.ToArray());
var black = new[] { game.Black.Name }.Concat(game.GetCurrentState().BlackCells.Select(x => (x is Die) ? ((Die) x).Value.ToString() : "." )).ToList();
black.Add(game.GetCurrentState().BlackCells.OfType<Die>().Sum(x => x.Value).ToString());
Csl.TableRow(black.ToArray());
Csl.Break(2);
}