本文整理汇总了C#中IList.AddRange方法的典型用法代码示例。如果您正苦于以下问题:C# IList.AddRange方法的具体用法?C# IList.AddRange怎么用?C# IList.AddRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IList
的用法示例。
在下文中一共展示了IList.AddRange方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Apply
public void Apply(IList<IElement> elements, DecompilationContext context)
{
var results = new List<IElement>();
this.ProcessRange(elements, 0, results, new Dictionary<IElement, IElement>());
elements.Clear();
elements.AddRange(results);
}
示例2: SpecPath
public SpecPath(string fullPath)
: base(fullPath)
{
_parts = new List<string>();
var path = new AssetPath(fullPath);
if (path.Package != null) _parts.Add(path.Package);
_parts.AddRange(path.Name.Split('/'));
}
示例3: AddAdditionalAssembliesAsync
/// <summary>
/// Adds additional assemblies to the ones already collected.
/// </summary>
/// <param name="assemblies">The collected assemblies.</param>
/// <param name="assemblyFilter">A filter for the assemblies.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>
/// A Task.
/// </returns>
protected override Task AddAdditionalAssembliesAsync(IList<Assembly> assemblies, Func<AssemblyName, bool> assemblyFilter, CancellationToken cancellationToken)
{
// load all the assemblies found in the application directory which are not already loaded.
var directory = this.GetAppLocation();
var loadedAssemblyFiles = assemblies.Select(this.GetFileName).Select(f => f.ToLowerInvariant());
var assemblyFiles = Directory.EnumerateFiles(directory, "*.dll", SearchOption.TopDirectoryOnly).Select(Path.GetFileName);
var assemblyFilesToLoad = assemblyFiles.Where(f => !loadedAssemblyFiles.Contains(f.ToLowerInvariant()));
assemblies.AddRange(assemblyFilesToLoad.Select(f => Assembly.LoadFile(Path.Combine(directory, f))).Where(a => assemblyFilter(a.GetName())));
return Task.FromResult((IEnumerable<Assembly>)assemblies);
}
示例4: ReplaceAnonymousType
private static void ReplaceAnonymousType(
IList<SymbolDisplayPart> list,
INamedTypeSymbol anonymousType,
IEnumerable<SymbolDisplayPart> parts)
{
var index = list.IndexOf(p => anonymousType.Equals(p.Symbol));
if (index >= 0)
{
var result = list.Take(index).Concat(parts).Concat(list.Skip(index + 1)).ToList();
list.Clear();
list.AddRange(result);
}
}
示例5: DisplayAssemblyList
private void DisplayAssemblyList(IList<string> assemblyList)
{
assemblyExplorerManager.ResetVisibleAssemblies();
if (assemblyList.Count == 0)
assemblyList.AddRange(GetVisibleAssemblyList());
else
{
ClearVisibleAssemblies();
var paths = from path in assemblyList
select new FileSystemPath(path);
assemblyExplorerManager.AddUserVisibleAssembly(paths.ToArray());
}
}
示例6: MethodCallObjects
public MethodCallObjects(Type concreteType, MethodInfo method)
{
ParameterExpression objectParameter = Expression.Parameter(concreteType, "x");
Parameters = method.GetParameters().Select(x => toInput(x)).ToList();
MethodCall = Expression.Call(objectParameter, method, Parameters.ToArray());
Parameters.Insert(0, objectParameter);
_parameterTypes = new List<Type>();
_parameterTypes.Add(concreteType);
_parameterTypes.AddRange(method.GetParameters().Select(x => x.ParameterType));
_parameterTypes.Add(method.ReturnType);
_parameterTypes.Remove(typeof (void));
}
示例7: ProcessRange
private void ProcessRange(IList<IElement> elements, int startIndex, IList<IElement> results, IDictionary<IElement, IElement> original)
{
for (var i = startIndex; i < elements.Count; i++) {
var element = elements[i];
if (!BranchProcessing.Matches(element, opCodes.Contains)) {
results.Add(element);
original[element] = element;
continue;
}
var targetIndexOrNull = BranchProcessing.FindTargetIndexOrNull(element, elements);
if (targetIndexOrNull == null)
BranchProcessing.ThrowTargetNotFound(element);
var targetIndex = targetIndexOrNull.Value;
BranchProcessing.EnsureNotBackward(i, targetIndex);
var targetRange = new List<IElement>();
this.ProcessRange(elements, targetIndex, targetRange, original);
var followingRange = new List<IElement>();
this.ProcessRange(elements, i + 1, followingRange, original);
var convergingRange = new List<IElement>();
while (targetRange.Count > 0 && followingRange.Count > 0) {
var lastTarget = targetRange.Last();
var lastFollowing = followingRange.Last();
if (original[lastTarget] != original[lastFollowing])
break;
convergingRange.Add(lastFollowing);
targetRange.RemoveAt(targetRange.Count - 1);
followingRange.RemoveAt(followingRange.Count - 1);
}
convergingRange.Reverse();
if (targetRange.Count > 0 || followingRange.Count > 0) {
var branching = new BranchingElement(((InstructionElement)element).OpCode, targetRange, followingRange);
original[branching] = element;
results.Add(branching);
}
results.AddRange(convergingRange);
break;
}
}
示例8: Build
public bool Build(IList<string> warnings, IList<string> errors)
{
var builder = _applicationHostContext.CreateInstance<ProjectBuilder>();
var result = builder.Build(_project.Name, _outputPath);
if (result.Errors != null)
{
errors.AddRange(result.Errors);
}
if (result.Warnings != null)
{
warnings.AddRange(result.Warnings);
}
return result.Success && errors.Count == 0;
}
示例9: WriteMagicalBonuses
public void WriteMagicalBonuses(IList<string> output, InventoryItem item, GameClient client, bool shortInfo)
{
int oldCount = output.Count;
WriteBonusLine(output, client, item.Bonus1Type, item.Bonus1);
WriteBonusLine(output, client, item.Bonus2Type, item.Bonus2);
WriteBonusLine(output, client, item.Bonus3Type, item.Bonus3);
WriteBonusLine(output, client, item.Bonus4Type, item.Bonus4);
WriteBonusLine(output, client, item.Bonus5Type, item.Bonus5);
WriteBonusLine(output, client, item.Bonus6Type, item.Bonus6);
WriteBonusLine(output, client, item.Bonus7Type, item.Bonus7);
WriteBonusLine(output, client, item.Bonus8Type, item.Bonus8);
WriteBonusLine(output, client, item.Bonus9Type, item.Bonus9);
WriteBonusLine(output, client, item.Bonus10Type, item.Bonus10);
WriteBonusLine(output, client, item.ExtraBonusType, item.ExtraBonus);
if (output.Count > oldCount)
{
output.Add(" ");
output.Insert(oldCount, LanguageMgr.GetTranslation(client.Account.Language, "DetailDisplayHandler.WriteMagicalBonuses.MagicBonus"));
output.Insert(oldCount, " ");
}
oldCount = output.Count;
WriteFocusLine(output, item.Bonus1Type, item.Bonus1);
WriteFocusLine(output, item.Bonus2Type, item.Bonus2);
WriteFocusLine(output, item.Bonus3Type, item.Bonus3);
WriteFocusLine(output, item.Bonus4Type, item.Bonus4);
WriteFocusLine(output, item.Bonus5Type, item.Bonus5);
WriteFocusLine(output, item.Bonus6Type, item.Bonus6);
WriteFocusLine(output, item.Bonus7Type, item.Bonus7);
WriteFocusLine(output, item.Bonus8Type, item.Bonus8);
WriteFocusLine(output, item.Bonus9Type, item.Bonus9);
WriteFocusLine(output, item.Bonus10Type, item.Bonus10);
WriteFocusLine(output, item.ExtraBonusType, item.ExtraBonus);
if (output.Count > oldCount)
{
output.Add(" ");
output.Insert(oldCount, LanguageMgr.GetTranslation(client.Account.Language, "DetailDisplayHandler.WriteMagicalBonuses.FocusBonus"));
output.Insert(oldCount, " ");
}
if (!shortInfo)
{
if (item.ProcSpellID != 0 || item.ProcSpellID1 != 0 || item.SpellID != 0 || item.SpellID1 != 0)
{
int requiredLevel = item.LevelRequirement > 0 ? item.LevelRequirement : Math.Min(50, item.Level);
output.Add(LanguageMgr.GetTranslation(client.Account.Language, "DetailDisplayHandler.WriteMagicalBonuses.LevelRequired2", requiredLevel));
output.Add(" ");
}
if (item.Object_Type == (int)eObjectType.Magical && item.Item_Type == (int)eInventorySlot.FirstBackpack) // potion
{
// let WritePotion handle the rest of the display
return;
}
#region Proc1
if (item.ProcSpellID != 0)
{
string spellNote = "";
output.Add(LanguageMgr.GetTranslation(client.Account.Language, "DetailDisplayHandler.WriteMagicalBonuses.MagicAbility"));
if (GlobalConstants.IsWeapon(item.Object_Type))
{
spellNote = LanguageMgr.GetTranslation(client.Account.Language, "DetailDisplayHandler.WriteMagicalBonuses.StrikeEnemy");
}
else if (GlobalConstants.IsArmor(item.Object_Type))
{
spellNote = LanguageMgr.GetTranslation(client.Account.Language, "DetailDisplayHandler.WriteMagicalBonuses.StrikeArmor");
}
SpellLine line = SkillBase.GetSpellLine(GlobalSpellsLines.Item_Effects);
if (line != null)
{
Spell procSpell = SkillBase.FindSpell(item.ProcSpellID, line);
if (procSpell != null)
{
ISpellHandler spellHandler = ScriptMgr.CreateSpellHandler(client.Player, procSpell, line);
if (spellHandler != null)
{
output.AddRange(spellHandler.DelveInfo);
output.Add(" ");
}
else
{
output.Add("-" + procSpell.Name + " (Spell Handler Not Implemented)");
}
output.Add(spellNote);
}
else
{
output.Add("- Spell Not Found: " + item.ProcSpellID);
}
}
else
//.........这里部分代码省略.........
示例10: WriteSpellInfo
/// <summary>
/// Write a formatted description of a spell
/// </summary>
/// <param name="output"></param>
/// <param name="spell"></param>
/// <param name="spellLine"></param>
/// <param name="client"></param>
public void WriteSpellInfo(IList<string> output, Spell spell, SpellLine spellLine, GameClient client)
{
if (client == null || client.Player == null)
return;
// check to see if player class handles delve
if (client.Player.DelveSpell(output, spell, spellLine))
return;
ISpellHandler spellHandler = ScriptMgr.CreateSpellHandler(client.Player, spell, spellLine);
if (spellHandler == null)
{
output.Add(" ");
output.Add("Spell type (" + spell.SpellType + ") is not implemented.");
}
else
{
output.AddRange(spellHandler.DelveInfo);
//Subspells
if (spell.SubSpellID > 0)
{
Spell s = SkillBase.GetSpellByID(spell.SubSpellID);
output.Add(" ");
ISpellHandler sh = ScriptMgr.CreateSpellHandler(client.Player, s, SkillBase.GetSpellLine(GlobalSpellsLines.Reserved_Spells));
output.AddRange(sh.DelveInfo);
}
}
if (client.Account.PrivLevel > 1)
{
output.Add(" ");
output.Add("--- Spell Technical Information ---");
output.Add(" ");
output.Add("Line: " + (spellHandler == null ? spellLine.KeyName : spellHandler.SpellLine.Name));
output.Add("Type: " + spell.SpellType);
output.Add(" ");
output.Add("SpellID: " + spell.ID);
output.Add("Icon: " + spell.Icon);
output.Add("Type: " + spell.SpellType);
output.Add("ClientEffect: " + spell.ClientEffect);
output.Add("Target: " + spell.Target);
output.Add("MoveCast: " + spell.MoveCast);
output.Add("Uninterruptible: " + spell.Uninterruptible);
output.Add("Value: " + spell.Value);
output.Add("LifeDrainReturn: " + spell.LifeDrainReturn);
if (spellHandler != null)
output.Add("HasPositiveEffect: " + spellHandler.HasPositiveEffect);
output.Add("SharedTimerGroup: " + spell.SharedTimerGroup);
output.Add("EffectGroup: " + spell.EffectGroup);
output.Add("SpellGroup (for hybrid grouping): " + spell.Group);
output.Add("Spell AllowCoexisting: " + spell.AllowCoexisting);
}
}
示例11: textEditor_TextArea_TextEntered
void textEditor_TextArea_TextEntered(object sender, TextCompositionEventArgs e)
{
completionWindow = new CompletionWindow(editor.TextArea);
data = completionWindow.CompletionList.CompletionData;
data.Clear();
if (e.Text == "." && e.Text == ";")
{
return;
}
else if (e.Text == "(")
{
insightWindow = new OverloadInsightWindow(editor.TextArea);
insightWindow.Provider = new OverloadProvider();
insightWindow.Show();
insightWindow.Closed += (o, args) => insightWindow = null;
}
else
{
foreach (var func in Functions)
{
data.Add(new MyCompletionData(func.Name, Properties.Resources.Method_636));
}
data.AddRange("function|delete|break|continue");
foreach (var obj in objects)
{
if(obj is Delegate)
{
data.Add(new MyCompletionData(obj.Key, Properties.Resources.Method_636));
}
else
{
data.Add(new MyCompletionData(obj.Key, Properties.Resources.Object_554));
}
}
}
if (data.Any())
{
completionWindow.Show();
}
completionWindow.Closed += delegate
{
completionWindow = null;
};
}
示例12: SetUp
public override void SetUp()
{
base.SetUp();
AllSortFields = new List<SortField>(Arrays.AsList(new SortField[] { new SortField("byte", SortField.Type_e.BYTE, false), new SortField("short", SortField.Type_e.SHORT, false), new SortField("int", SortField.Type_e.INT, false), new SortField("long", SortField.Type_e.LONG, false), new SortField("float", SortField.Type_e.FLOAT, false), new SortField("double", SortField.Type_e.DOUBLE, false), new SortField("bytes", SortField.Type_e.STRING, false), new SortField("bytesval", SortField.Type_e.STRING_VAL, false), new SortField("byte", SortField.Type_e.BYTE, true), new SortField("short", SortField.Type_e.SHORT, true), new SortField("int", SortField.Type_e.INT, true), new SortField("long", SortField.Type_e.LONG, true), new SortField("float", SortField.Type_e.FLOAT, true), new SortField("double", SortField.Type_e.DOUBLE, true), new SortField("bytes", SortField.Type_e.STRING, true), new SortField("bytesval", SortField.Type_e.STRING_VAL, true), SortField.FIELD_SCORE, SortField.FIELD_DOC }));
if (SupportsDocValues)
{
AllSortFields.AddRange(Arrays.AsList(new SortField[] { new SortField("intdocvalues", SortField.Type_e.INT, false), new SortField("floatdocvalues", SortField.Type_e.FLOAT, false), new SortField("sortedbytesdocvalues", SortField.Type_e.STRING, false), new SortField("sortedbytesdocvaluesval", SortField.Type_e.STRING_VAL, false), new SortField("straightbytesdocvalues", SortField.Type_e.STRING_VAL, false), new SortField("intdocvalues", SortField.Type_e.INT, true), new SortField("floatdocvalues", SortField.Type_e.FLOAT, true), new SortField("sortedbytesdocvalues", SortField.Type_e.STRING, true), new SortField("sortedbytesdocvaluesval", SortField.Type_e.STRING_VAL, true), new SortField("straightbytesdocvalues", SortField.Type_e.STRING_VAL, true) }));
}
// Also test missing first / last for the "string" sorts:
foreach (string field in new string[] { "bytes", "sortedbytesdocvalues" })
{
for (int rev = 0; rev < 2; rev++)
{
bool reversed = rev == 0;
SortField sf = new SortField(field, SortField.Type_e.STRING, reversed);
sf.MissingValue = SortField.STRING_FIRST;
AllSortFields.Add(sf);
sf = new SortField(field, SortField.Type_e.STRING, reversed);
sf.MissingValue = SortField.STRING_LAST;
AllSortFields.Add(sf);
}
}
int limit = AllSortFields.Count;
for (int i = 0; i < limit; i++)
{
SortField sf = AllSortFields[i];
if (sf.Type == SortField.Type_e.INT)
{
SortField sf2 = new SortField(sf.Field, SortField.Type_e.INT, sf.Reverse);
sf2.MissingValue = Random().Next();
AllSortFields.Add(sf2);
}
else if (sf.Type == SortField.Type_e.LONG)
{
SortField sf2 = new SortField(sf.Field, SortField.Type_e.LONG, sf.Reverse);
sf2.MissingValue = Random().NextLong();
AllSortFields.Add(sf2);
}
else if (sf.Type == SortField.Type_e.FLOAT)
{
SortField sf2 = new SortField(sf.Field, SortField.Type_e.FLOAT, sf.Reverse);
sf2.MissingValue = (float)Random().NextDouble();
AllSortFields.Add(sf2);
}
else if (sf.Type == SortField.Type_e.DOUBLE)
{
SortField sf2 = new SortField(sf.Field, SortField.Type_e.DOUBLE, sf.Reverse);
sf2.MissingValue = Random().NextDouble();
AllSortFields.Add(sf2);
}
}
Dir = NewDirectory();
RandomIndexWriter iw = new RandomIndexWriter(Random(), Dir);
int numDocs = AtLeast(200);
for (int i = 0; i < numDocs; i++)
{
IList<Field> fields = new List<Field>();
fields.Add(NewTextField("english", English.IntToEnglish(i), Field.Store.NO));
fields.Add(NewTextField("oddeven", (i % 2 == 0) ? "even" : "odd", Field.Store.NO));
fields.Add(NewStringField("byte", "" + ((sbyte)Random().Next()), Field.Store.NO));
fields.Add(NewStringField("short", "" + ((short)Random().Next()), Field.Store.NO));
fields.Add(new IntField("int", Random().Next(), Field.Store.NO));
fields.Add(new LongField("long", Random().NextLong(), Field.Store.NO));
fields.Add(new FloatField("float", (float)Random().NextDouble(), Field.Store.NO));
fields.Add(new DoubleField("double", Random().NextDouble(), Field.Store.NO));
fields.Add(NewStringField("bytes", TestUtil.RandomRealisticUnicodeString(Random()), Field.Store.NO));
fields.Add(NewStringField("bytesval", TestUtil.RandomRealisticUnicodeString(Random()), Field.Store.NO));
fields.Add(new DoubleField("double", Random().NextDouble(), Field.Store.NO));
if (SupportsDocValues)
{
fields.Add(new NumericDocValuesField("intdocvalues", Random().Next()));
fields.Add(new FloatDocValuesField("floatdocvalues", (float)Random().NextDouble()));
fields.Add(new SortedDocValuesField("sortedbytesdocvalues", new BytesRef(TestUtil.RandomRealisticUnicodeString(Random()))));
fields.Add(new SortedDocValuesField("sortedbytesdocvaluesval", new BytesRef(TestUtil.RandomRealisticUnicodeString(Random()))));
fields.Add(new BinaryDocValuesField("straightbytesdocvalues", new BytesRef(TestUtil.RandomRealisticUnicodeString(Random()))));
}
Document document = new Document();
document.Add(new StoredField("id", "" + i));
if (VERBOSE)
{
Console.WriteLine(" add doc id=" + i);
}
foreach (Field field in fields)
{
// So we are sometimes missing that field:
if (Random().Next(5) != 4)
{
document.Add(field);
if (VERBOSE)
{
Console.WriteLine(" " + field);
}
//.........这里部分代码省略.........
示例13: MapResults
private void MapResults(ITwitterSearchQuery search, IList<NewsItem> results)
{
var r = search.Request()
.AsSearchResult();
results.AddRange(r.Statuses.ConvertAll(t => new NewsItem
{
Author = t.FromUserScreenName,
AuthorPhotoUrl = t.ProfileImageUrl,
AuthorUrl = "http://twitter.com/{0}".FormatWith(t.FromUserScreenName),
PublishedTime = t.CreatedDate,
Headline = t.Text,
Url = t.Source
}));
}
示例14: SplatAppend
public static IList/*!*/ SplatAppend(IList/*!*/ array, object splattee) {
IEnumerable<object> objList;
IEnumerable iList;
if ((objList = splattee as IEnumerable<object>) != null) {
array.AddRange(objList);
} else if ((iList = splattee as IEnumerable) != null) {
array.AddRange(iList);
} else {
array.Add(splattee);
}
return array;
}
示例15: FilterAndAddTemplates
static IEnumerable<ICompletionItem> FilterAndAddTemplates(ITextEditor editor, IList<ICompletionItem> items)
{
List<ISnippetCompletionItem> snippets = editor.GetSnippets().ToList();
snippets.RemoveAll(item => !FitsInContext(item, items));
items.RemoveAll(item => ClassBrowserIconService.Keyword.Equals(item.Image) && snippets.Exists(i => i.Text == item.Text));
items.AddRange(snippets);
return items;
}