本文整理汇总了C#中XCore.List.RemoveAll方法的典型用法代码示例。如果您正苦于以下问题:C# List.RemoveAll方法的具体用法?C# List.RemoveAll怎么用?C# List.RemoveAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XCore.List
的用法示例。
在下文中一共展示了List.RemoveAll方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RebuildStatisticsTable
private void RebuildStatisticsTable()
{
statisticsBox.Clear();
// TODO-Linux: SelectionTabs isn't implemented on Mono
statisticsBox.SelectionTabs = new int[] { 10, 300};
//retrieve the default UI font.
var font = FontHeightAdjuster.GetFontForStyle(StyleServices.NormalStyleName,
FontHeightAdjuster.StyleSheetFromMediator(mediator),
Cache.DefaultUserWs, Cache.WritingSystemFactory);
//increase the size of the default UI font and make it bold for the header.
Font headerFont = new Font(font.FontFamily, font.SizeInPoints + 1.0f, FontStyle.Bold, font.Unit, font.GdiCharSet);
//refresh the statisticsDescription (in case of font changes)
statisticsBox.Text = ITextStrings.ksStatisticsView_HeaderText;
int row = 0;
var textList = InterestingTextsDecorator.GetInterestingTextList(mediator, Cache.ServiceLocator);
int numberOfSegments = 0;
int wordCount = 0;
int uniqueWords = 0;
Dictionary<int, int> languageCount = new Dictionary<int, int>();
Dictionary<int, Set<String>> languageTypeCount = new Dictionary<int, Set<String>>();
//for each interesting text
foreach (var text in textList.InterestingTexts)
{
//if a text is deleted in Interlinear there could be a text in this list which has invalid data.
if (text.Hvo < 0)
continue;
//for every paragraph in the interesting text
for (int index = 0; index < text.ParagraphsOS.Count; ++index)
{
//count the segments in this paragraph
numberOfSegments += text[index].SegmentsOS.Count;
//count all the things analyzed as words
var words = new List<IAnalysis>(text[index].Analyses);
foreach (var word in words)
{
var wordForm = word.Wordform;
if (wordForm != null)
{
var valdWSs = wordForm.Form.AvailableWritingSystemIds;
foreach (var ws in valdWSs)
{
// increase the count of words(tokens) for this language
int count = 0;
if (languageCount.TryGetValue(ws, out count))
{
languageCount[ws] = count + 1;
}
else
{
languageCount.Add(ws, 1);
}
//increase the count of unique words(types) for this language
Set<String> pair;
if (languageTypeCount.TryGetValue(ws, out pair))
{
//add the string for this writing system in all lower case to the set, unique count is case insensitive
pair.Add(word.Wordform.Form.get_String(ws).Text.ToLower());
}
else
{
//add the string for this writing system in all lower case to the set, unique count is case insensitive
languageTypeCount.Add(ws, new Set<String> { word.Wordform.Form.get_String(ws).Text.ToLower() });
}
}
}
}
words.RemoveAll(item => !item.HasWordform);
wordCount += words.Count;
}
}
// insert total word type count
statisticsBox.Text += Environment.NewLine + Environment.NewLine + Environment.NewLine + "\t" + ITextStrings.ksStatisticsViewTotalWordTypesText + "\t"; // Todo: find the right System.?.NewLine constant
++row;
//add one row for the unique words in each language.
foreach (KeyValuePair<int, Set<String>> keyValuePair in languageTypeCount)
{
var ws = Cache.WritingSystemFactory.get_EngineOrNull(keyValuePair.Key);
string labText = (ws != null ? ws.ToString() : "#unknown#") + @":";
statisticsBox.Text += Environment.NewLine + Environment.NewLine + "\t" + labText + "\t"; // Todo: find the right System.?.NewLine constant
statisticsBox.Text += "" + keyValuePair.Value.Count;
++row;
uniqueWords += keyValuePair.Value.Count; //increase the total of unique words
}
// next insert the word count.
statisticsBox.Text += Environment.NewLine + Environment.NewLine + Environment.NewLine + "\t" + ITextStrings.ksStatisticsViewTotalWordTokensText + "\t"; // Todo: find the right System.?.NewLine constant
statisticsBox.Text += wordCount;
++row;
//add one row for the token count for each language.
foreach (KeyValuePair<int, int> keyValuePair in languageCount)
{
var ws = Cache.WritingSystemFactory.get_EngineOrNull(keyValuePair.Key);
string labText = (ws != null ? ws.ToString() : "#unknown#") + @":";
statisticsBox.Text += Environment.NewLine + Environment.NewLine + "\t" + labText + "\t"; // Todo: find the right System.?.NewLine constant
//.........这里部分代码省略.........