本文整理汇总了C#中Dynamo.Nodes.List.Last方法的典型用法代码示例。如果您正苦于以下问题:C# List.Last方法的具体用法?C# List.Last怎么用?C# List.Last使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dynamo.Nodes.List
的用法示例。
在下文中一共展示了List.Last方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReduceRowCount
/// <summary>
/// Reduces the number of rows, based on the entries inside rows parameter.
/// E.g. rows = { "Insert", "Day", "Of", "Week", "Here" }, maxRows == 3
/// Result { "Insert", "Day", "Of Week Here" }
/// </summary>
/// <param name="rows">Incoming rows</param>
/// <param name="maxRows">Max number of rows</param>
internal static IEnumerable<string> ReduceRowCount(List<string> rows, int maxRows)
{
if (rows == null || maxRows <= 0)
throw new ArgumentException();
var results = new List<string>();
foreach (var row in rows)
{
// There are still room in the results list.
if (results.Count < maxRows)
{
results.Add(row);
continue;
}
// Already full, keep appending to last row.
var lastRow = results.Last();
results.Remove(lastRow);
results.Add(lastRow + " " + row);
}
return results;
}