本文整理汇总了C#中SortedSet.Union方法的典型用法代码示例。如果您正苦于以下问题:C# SortedSet.Union方法的具体用法?C# SortedSet.Union怎么用?C# SortedSet.Union使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SortedSet
的用法示例。
在下文中一共展示了SortedSet.Union方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CodeContext
internal CodeContext(
string name,
IEnumerable<string> tags,
string authors = null,
string source = null,
string syntax = null,
string description = null,
string prerequisites = null,
CodeContext parentContext = null)
{
if (string.IsNullOrWhiteSpace(name))
throw new ArgumentException("name");
if (tags == null)
throw new ArgumentException("tags");
Name = name;
Authors = authors ?? (parentContext != null ? parentContext.Authors : string.Empty);
Source = source ?? (parentContext != null ? parentContext.Source : string.Empty);
Syntax = syntax ?? (parentContext != null ? parentContext.Syntax : string.Empty);
SpecificTags = new SortedSet<string>(tags);
Description = description ?? string.Empty;
Prerequisites = prerequisites ?? string.Empty;
ParentContext = parentContext;
AllTags = parentContext != null
? new SortedSet<string>(SpecificTags.Union(parentContext.AllTags))
: new SortedSet<string>(SpecificTags);
}
示例2: Main
static void Main()
{
var s1 = new Set<int>();
s1.Added += (sender, args) => Console.WriteLine("Добавлено: " + args);
s1.Add(8,2,9);
var ss1 = new SortedSet<int>(2, 5, 7, 4);
Console.WriteLine("The first SortedSet: " + ss1);
Console.WriteLine("Приведённое:" + (Set<int>)ss1);
var ss2 = new SortedSet<int>(2, 9, 7, 4);
Console.WriteLine("The second SortedSet: " + ss2);
Console.WriteLine("Intersection: " + ss1.Intersect(ss2));
Console.WriteLine("Union: " + ss1.Union(ss2));
Console.WriteLine("Is the first SortedSet contain " + 5 + ": " + ss1.Contains(5));
Console.ReadKey();
}
示例3: CodeSnippet
internal CodeSnippet(
string code,
IEnumerable<string> tags,
CodeContext context = null)
{
if (tags == null)
throw new ArgumentException("tags");
Code = code ?? string.Empty;
Authors = context != null ? context.Authors : string.Empty;
Source = context != null ? context.Source : string.Empty;
Syntax = context != null ? context.Syntax : string.Empty;
SpecificTags = new SortedSet<string>(tags);
AllTags = context != null
? new SortedSet<string>(SpecificTags.Union(context.AllTags))
: new SortedSet<string>(SpecificTags);
Context = context;
}
示例4: QonverterSettingsByAnalysisControl
public QonverterSettingsByAnalysisControl (IDictionary<Analysis, QonverterSettings> qonverterSettingsByAnalysis,
QonverterSettingsManagerNeeded qonverterSettingsManagerNeeded)
{
InitializeComponent();
if (qonverterSettingsManagerNeeded == null)
throw new NullReferenceException();
this.qonverterSettingsByAnalysis = qonverterSettingsByAnalysis;
this.qonverterSettingsManagerNeeded = qonverterSettingsManagerNeeded;
qonverterSettingsByName = QonverterSettings.LoadQonverterSettings();
qonverterSettingsByName.Keys.ToList().ForEach(o => qonverterSettingsColumn.Items.Add(o));
qonverterSettingsColumn.Items.Add("Edit...");
foreach (var kvp in qonverterSettingsByAnalysis)
{
Analysis a = kvp.Key;
var row = new DataGridViewRow();
row.CreateCells(dataGridView);
IEnumerable<AnalysisParameter> diffParameters = new SortedSet<AnalysisParameter>();
foreach (var a2 in qonverterSettingsByAnalysis.Keys)
{
if (a.Software.Name != a2.Software.Name)
continue;
diffParameters = diffParameters.Union(a.Parameters.Except(a2.Parameters));
}
string key = a.Id + ": " + a.Name;
foreach (var p in diffParameters)
key += String.Format("; {0}={1}", p.Name, p.Value);
string defaultDecoyPrefix = a.Parameters.Where(o => o.Name.Contains("DecoyPrefix")).Select(o => o.Value).FirstOrDefault() ??
Properties.Settings.Default.DefaultDecoyPrefix;
row.Tag = a;
row.Cells[0].Value = key;
row.Cells[1].Value = a.QonverterSettings != null ? a.QonverterSettings.DecoyPrefix : defaultDecoyPrefix;
var comboBox = row.Cells[2] as DataGridViewComboBoxCell;
var firstSoftwarePreset = qonverterSettingsByName.Keys.FirstOrDefault( o => o.ToLower().Contains(kvp.Key.Software.Name.ToLower()));
if (kvp.Value == null)
{
comboBox.Value = firstSoftwarePreset ?? qonverterSettingsByName.Keys.FirstOrDefault();
}
else
{
// load default if nothing found
string settingsMatch = firstSoftwarePreset ?? qonverterSettingsByName.Keys.FirstOrDefault();
// see if database recognizes settings
foreach (var item in qonverterSettingsByName)
{
if (item.Value.ChargeStateHandling == kvp.Value.ChargeStateHandling &&
item.Value.Kernel == kvp.Value.Kernel &&
item.Value.MassErrorHandling == kvp.Value.MassErrorHandling &&
item.Value.MissedCleavagesHandling == kvp.Value.MissedCleavagesHandling &&
item.Value.QonverterMethod == kvp.Value.QonverterMethod &&
item.Value.RerankMatches == kvp.Value.RerankMatches &&
item.Value.TerminalSpecificityHandling == kvp.Value.TerminalSpecificityHandling &&
item.Value.ScoreInfoByName.SequenceEqual(kvp.Value.ScoreInfoByName))
{
settingsMatch = item.Key;
break;
}
}
// initialize combo box value
if (!String.IsNullOrEmpty(settingsMatch))
comboBox.Value = settingsMatch;
}
dataGridView.Rows.Add(row);
}
foreach (DataGridViewRow row in dataGridView.Rows)
{
qonverterSettingsByAnalysis[row.Tag as Analysis] = qonverterSettingsByName[(string) row.Cells[2].Value];
qonverterSettingsByAnalysis[row.Tag as Analysis].Analysis = row.Tag as Analysis;
qonverterSettingsByAnalysis[row.Tag as Analysis].DecoyPrefix = (string) row.Cells[1].Value;
}
dataGridView.CellBeginEdit += new DataGridViewCellCancelEventHandler(dataGridView_CellBeginEdit);
dataGridView.CurrentCellDirtyStateChanged += new EventHandler(dataGridView_CurrentCellDirtyStateChanged);
}