本文整理汇总了C#中Data.List.Sort方法的典型用法代码示例。如果您正苦于以下问题:C# List.Sort方法的具体用法?C# List.Sort怎么用?C# List.Sort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Data.List
的用法示例。
在下文中一共展示了List.Sort方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MergeFiles
public static void MergeFiles(Repository repo)
{
var f1 = repo.StorageWrapper.Data.MineableDataResultsDirectory + Extractor.UniqueEmailAddressesFilename;
var f2 = repo.StorageWrapper.Data.MineableDataDirectory + Extractor.LinkedInFilename;
var f3 = repo.StorageWrapper.Data.MineableDataDirectory + Extractor.IgnoreListFilename;
if (!File.Exists(f1))
{
Console.WriteLine("Unable to locate " + f1);
return;
}
if (!File.Exists(f2))
{
Console.WriteLine("Unable to locate " + f2);
return;
}
if (!File.Exists(f3))
{
Console.WriteLine("Unable to locate " + f3);
return;
}
var mozilla = File.ReadLines(f1).ToList();
var linkedIn = File.ReadLines(f2).ToList();
var ignore = File.ReadLines(f3).ToList();
var final = new List<string>();
foreach (var line in mozilla.Where(line => !final.Contains(line.ToLower())).Where(line => ignore.All(ignorePart => !line.ToLower().Contains(ignorePart.ToLower()))))
{
final.Add(line.ToLower());
}
foreach (var line in linkedIn.Where(line => !final.Contains(line.ToLower())).Where(line => ignore.All(ignorePart => !line.ToLower().Contains(ignorePart.ToLower()))))
{
final.Add(line.ToLower());
}
final.Sort();
File.WriteAllLines(repo.StorageWrapper.Data.MineableDataResultsDirectory + Extractor.ConvergedEmailAddressesFilename, final);
var domains = final.Where(x => x.Contains('@')).Select(x => x.Split('@')[1]).Distinct().ToList();
domains.Sort();
File.WriteAllLines(repo.StorageWrapper.Data.MineableDataResultsDirectory + Extractor.UniqueDomainsFilename, domains);
if (UIRetriever.GetBool(String.Format("View {0}?", Extractor.ConvergedEmailAddressesFilename)))
{
FileVisualiser.Show(repo.StorageWrapper.Data.MineableDataResultsDirectory + Extractor.ConvergedEmailAddressesFilename);
}
if (UIRetriever.GetBool(String.Format("View {0}?", repo.StorageWrapper.Data.MineableDataResultsDirectory)))
{
DirectoryVisualiser.ShowFile(repo.StorageWrapper.Data.MineableDataResultsDirectory + Extractor.ConvergedEmailAddressesFilename);
}
}
示例2: WriteTable
void WriteTable()
{
int teamIndex = 0;
int scoreIndex = 1;
int currentRow = 1;
List<Team> teams = new List<Team>(Program.main.archive.settings.teams);
teams.Sort();
foreach(var t in teams) {
// Figure out relation and write text
var title = new Label();
title.Text = t.name;
title.TextAlign = ContentAlignment.MiddleCenter;
title.Dock = DockStyle.Fill;
table.Controls.Add(title, teamIndex, currentRow);
var score = new Label();
score.Text = t.score + " " + Program.main.archive.settings.messages.fakePointsName;
score.TextAlign = ContentAlignment.MiddleCenter;
score.Dock = DockStyle.Fill;
table.Controls.Add(score, scoreIndex, currentRow);
currentRow += 1;
}
}