本文整理汇总了C#中Collection.Skip方法的典型用法代码示例。如果您正苦于以下问题:C# Collection.Skip方法的具体用法?C# Collection.Skip怎么用?C# Collection.Skip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Collection
的用法示例。
在下文中一共展示了Collection.Skip方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: populateQueueList
private void populateQueueList(Collection<string> queue)
{
continuousList.Items.Clear();
foreach (string s in queue.Skip(1))
{
continuousList.Items.Add(directions[s]);
}
}
示例2: Main
static void Main(string[] args)
{
var datafile = String.Empty;
while (datafile == String.Empty)
{
Console.WriteLine("Please type data file name");
datafile = Console.ReadLine();
if (!File.Exists(datafile))
{
datafile = String.Empty;
}
}
const decimal TaxRate = 0.07m;
const decimal MarginRate = 0.11m;
const decimal ExtraMarginRate = 0.16m;
var job = new Job();
var lines = File.ReadAllLines(datafile);
var linescoll = new Collection<string>(lines);
var skipindex = 0;
if (lines[0] == "extra-margin")
{
job.ExtraMargin = true;
skipindex = 1;
}
else
{
job.ExtraMargin = false;
}
foreach(var line in linescoll.Skip(skipindex))
{
var item = line.Split(' ');
var jobitem = new JobItem { Name = item[0], Price = Convert.ToDecimal(item[1]), Exempt = item.Length>2&& item[2]== "exempt" };
job.AddItem(jobitem);
}
//job.Items = GetItemsList();
foreach(var item in job.Items)
{
if (item.Exempt)
{
item.Tax = 0.0m;
}
else
{
item.Tax = item.Price * TaxRate;
}
if (job.ExtraMargin)
{
job.Margin += item.Price * ExtraMarginRate;
}
else
{
job.Margin += item.Price * MarginRate;
}
job.TotalPrice += item.Price + item.Tax;
}
job.TotalPrice += job.Margin;
job.PrintReceipt();
//Console.ReadLine();
}