本文整理汇总了C#中Data.List.AddRange方法的典型用法代码示例。如果您正苦于以下问题:C# List.AddRange方法的具体用法?C# List.AddRange怎么用?C# List.AddRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Data.List
的用法示例。
在下文中一共展示了List.AddRange方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildStandardSinkSet
public static BuiltComponents BuildStandardSinkSet(IStandardSinkSetConfiguration simpleConfig, IEnumerable<ISnapshotProvider> source)
{
var sources = new List<ISnapshotProvider>();
sources.AddRange(source);
var bufferElement = new SinkElement(simpleConfig);
var storeElement = new StoreElement(simpleConfig);
var plotterElement = new PlotterElement(simpleConfig);
var bufferConfig = new CircularDataSinkConfiguration(new[] {bufferElement});
var storeConfig = new FileSystemDataStoreConfiguration(new[] {storeElement});
var plotterConfig = new PlotterConfiguration(new[] {plotterElement});
var sinks = new List<ISnapshotConsumer>();
var buffers = CircularDataSinkBuilder.Build(bufferConfig);
sinks.AddRange(buffers);
sources.AddRange(buffers);
var stores = FileSystemDataStoreBuilder.Build(storeConfig);
sinks.AddRange(stores);
sources.AddRange(stores);
var multiSinks = new List<IMultipleSnapshotConsumer>();
multiSinks.AddRange(MultiPlotterBuilder.Build(plotterConfig));
var bufferChainElement = new ChainElement(
simpleConfig.Id + " Buffer Chain",
simpleConfig.Name,
simpleConfig.Id + " Source",
simpleConfig.Id + " Buffer",
"");
var sinkChainElement = new ChainElement(
simpleConfig.Id + " Sink Chain",
simpleConfig.Name,
simpleConfig.Id + " Buffer",
simpleConfig.Id + " Store",
simpleConfig.Id + " Plotter");
var preloadChainElement = new ChainElement(
simpleConfig.Id + " Preload Chain",
simpleConfig.Name,
simpleConfig.Id + " Store",
simpleConfig.Id + " Buffer",
"");
var chainConfig = new ChainConfiguration(new[] {bufferChainElement, sinkChainElement, preloadChainElement});
var preloadScheduleElement = new ScheduleElement(simpleConfig.Id + " Preload Schedule", simpleConfig.Delay,
preloadChainElement.Id);
var preloadScheduleConfig = new ScheduleConfiguration(new[] {preloadScheduleElement});
var chainNames = String.Join(",", new[] {sinkChainElement.Id, bufferChainElement.Id});
var scheduleElement = new ScheduleElement(simpleConfig.Id + " Schedule", simpleConfig.Delay, chainNames);
var scheduleConfig = new ScheduleConfiguration(new[] {scheduleElement});
return new BuiltComponents(sources, sinks, multiSinks, chainConfig, preloadScheduleConfig, scheduleConfig);
}
示例2: StatC5CX
public void StatC5CX(List<DwNumber> numbers, string dbName)
{
string[] dmNames = new string[] { "Peroid", "He" };
string[] numberTypes = new string[] { "A2", "A3", "A4", "A6", "A7", "A8" };
DwC5CXSpanBiz spanBiz = new DwC5CXSpanBiz(dbName);
foreach (var numberType in numberTypes)
{
Dictionary<string, Dictionary<string, int>> lastSpanDict = new Dictionary<string, Dictionary<string, int>>(16);
List<DwC5CXSpan> c5cxSpans = new List<DwC5CXSpan>(numbers.Count * 20);
string newNumberType = numberType.Replace("A", "C");
string tableName = string.Format("{0}{1}", "C5", newNumberType);
spanBiz.DataAccessor.TableName = ConfigHelper.GetDwSpanTableName(tableName);
long lastP = spanBiz.DataAccessor.SelectLatestPeroid(string.Empty);
foreach (DwNumber number in numbers)
{
var cxNumbers = NumberCache.Instance.GetC5CXNumbers(number.C5, newNumberType);
var c5cxSpanList = this.GetC5CXSpanList(lastSpanDict, cxNumbers, number, dmNames);
if (number.P > lastP)
c5cxSpans.AddRange(c5cxSpanList);
}
spanBiz.DataAccessor.Insert(c5cxSpans, SqlInsertMethod.SqlBulkCopy);
Console.WriteLine("{0} {1} Finished", dbName, tableName);
}
Console.WriteLine("{0} {1} Finished", dbName, "ALL C5CX Span");
}
示例3: GetFarFromOneRelations
public static List<UserProfile> GetFarFromOneRelations(Guid userId)
{
// On cherche nos relations. On cherche les relations de nos relations => récursif
List<UserProfile> listUserRelations = GetRelations(userId);
List<UserProfile> listLoggedUserRelation = GetRelations((Guid)(Membership.GetUser(System.Web.HttpContext.Current.User.Identity.Name, false).ProviderUserKey));
List<UserProfile> listFarFromOneRelations = new List<UserProfile>();
// We search all the directly connected users to the actual logged user relations
foreach (UserProfile userRelation in listUserRelations)
{
listFarFromOneRelations.AddRange(GetRelations((Guid)(Membership.GetUser(userRelation.UserName, false).ProviderUserKey)));
}
UserProfile actualUser = UserProfile.GetUserProfile(System.Web.HttpContext.Current.User.Identity.Name);
while(listFarFromOneRelations.Contains(actualUser))
{
// We delete all the occurences of the actual user
listFarFromOneRelations.Remove(actualUser);
}
// On supprime les utilisateurs qui sont déjà directement connectés avec l'utilisateur
foreach (UserProfile user in listLoggedUserRelation)
{
if (listFarFromOneRelations.Contains(user))
{
listFarFromOneRelations.Remove(user);
}
}
return listFarFromOneRelations;
}
示例4: GetConnectionInfosForSelectedServers
List<ConnectionInfo> GetConnectionInfosForSelectedServers(string[] hostnames)
{
// TODO: support for wildcards
var connectionInfosApplicable = new List<ConnectionInfo>();
if (hostnames.Any())
connectionInfosApplicable.AddRange(hostnames.SelectMany(hostname => ConnectionData.Entries.Where(connData => 0 == string.Compare(connData.Host, hostname, StringComparison.OrdinalIgnoreCase))));
else
connectionInfosApplicable = ConnectionData.Entries;
return connectionInfosApplicable;
}
示例5: GetMachinesFromServer
IEnumerable<IEsxiVirtualMachine> GetMachinesFromServer(IEnumerable<ConnectionInfo> connectionInfos)
{
var vms = new List<IEsxiVirtualMachine>();
var codeRunner = new CrossHostCodeRunner();
Func<PlainTextDataConverter, string, string, List<IEsxiVirtualMachine>> runnerFunc = (runner, textData, server) => runner.GetMachines(textData, server);
foreach (var connInfo in connectionInfos)
// TODO: error handling
vms.AddRange(codeRunner.Run<PlainTextDataConverter, List<IEsxiVirtualMachine>>(connInfo, Commands.GetVirtualMachines, runnerFunc));
return vms;
}
示例6: getAllEstadoCaja
public static List<movimiento_caja> getAllEstadoCaja(edificio edificio, DateTime periodo)
{
DateTime p = DateTime.Parse("1/" + periodo.Month + "/" + periodo.Year);
List<movimiento_caja> movimientos = new List<movimiento_caja>();
movimiento_caja mc = new movimiento_caja();
mc.fecha = p;
mc.concepto = "Saldo mes anterior";
mc.importe = getSaldoMesAnterior(edificio, p);
movimientos.Add(mc);
movimientos.AddRange(CatalogoCajaEdificio.getMovmientosEdificio(edificio, p));
return movimientos;
}
示例7: CreateCategory
static Category CreateCategory()
{
var fd1 = new FieldDefinition { Id = new Guid("00000000-0000-0000-0000-000000000001"), Name = "Val1", FieldType = typeof(int) };
var fd2 = new FieldDefinition { Id = new Guid("00000000-0000-0000-0000-000000000002"), Name = "Val2", FieldType = typeof(string) };
var fd3 = new FieldDefinition { Id = new Guid("00000000-0000-0000-0000-000000000003"), Name = "Val3", FieldType = typeof(long) };
var blueprint = new List<FieldDefinition>(3);
blueprint.AddRange(new[] { fd1, fd2, fd3 });
return new Category
{
//Id = Guid.NewGuid(),
Name = "Category 1",
Fields = blueprint
};
}
示例8: GetAssemblies
public static List<LeagueSharpAssembly> GetAssemblies(string directory, string url = "")
{
var projectFiles = new List<string>();
var foundAssemblies = new List<LeagueSharpAssembly>();
try
{
projectFiles.AddRange(Directory.GetFiles(directory, "*.csproj", SearchOption.AllDirectories));
foundAssemblies.AddRange(from projectFile in projectFiles let name = Path.GetFileNameWithoutExtension(projectFile) select new LeagueSharpAssembly(name, projectFile, url));
}
catch (Exception e)
{
Utility.Log(LogStatus.Error, "Updater", e.ToString(), Logs.MainLog);
}
return foundAssemblies;
}
示例9: CreateFactor
static Factor CreateFactor(Category category, int iterator)
{
var f1 = new FieldValue<int>(new Guid("00000000-0000-0000-0000-000000000001"), iterator);
var f2 = new FieldValue<string>(new Guid("00000000-0000-0000-0000-000000000002"), "Ahoj " + iterator);
var f3 = new FieldValue<long>(new Guid("00000000-0000-0000-0000-000000000003"), 1000000000L + iterator);
var construct = new List<FieldValue>(3);
construct.AddRange(new FieldValue[] { f1, f2, f3 });
return new Factor
{
//Id = Guid.NewGuid(),
Name = "Factor " + iterator,
Category = category,
Fields = construct
};
}
示例10: btnGenerar_Click
private void btnGenerar_Click(object sender, EventArgs e)
{
if (cmbEdificios.CheckedItems.Count > 0)
{
var output = new List<edificio>(cmbEdificios.CheckedItems.Count);
output.AddRange(cmbEdificios.CheckedItems.Cast<edificio>());
LoadingForm loading = new LoadingForm();
(new Thread(() => loading.ShowDialog())).Start();
Business.ControladorInformes.generarInformeUnidadesEdificio(output);
Invoke(new Action(() => loading.Close()));
if (MessageBox.Show("Desea abrir la carpeta con los archivos generados?", "Sistema", MessageBoxButtons.YesNo) == DialogResult.Yes)
//System.Diagnostics.Process.Start(@"Liquidaciones\" + edi.direccion + periodo.Month + "-" + periodo.Year + ".pdf");
System.Diagnostics.Process.Start("Listados unidades\\");
this.Close();
}
else
MessageBox.Show("Seleccione al menos un edificio", "Sistema");
}
示例11: ProcessChildren
/// <summary>
/// Processes the children.
/// </summary>
/// <param name="rootItem">The root item.</param>
/// <param name="itemsRedirectsList">The items redirects list.</param>
/// <param name="sectionsRedirectList">The sections redirect list.</param>
/// <param name="regExList">The reg ex list.</param>
/// <param name="itemsRedirectsListOut">The items redirects list out.</param>
/// <param name="sectionsRedirectListOut">The sections redirect list out.</param>
/// <param name="regExListOut">The reg ex list out.</param>
private static void ProcessChildren(Item rootItem,
List<RedirectItem> itemsRedirectsList,
List<RedirectItem> sectionsRedirectList,
List<RegExItem> regExList,
out List<RedirectItem> itemsRedirectsListOut,
out List<RedirectItem> sectionsRedirectListOut,
out List<RegExItem> regExListOut)
{
itemsRedirectsListOut = itemsRedirectsList;
sectionsRedirectListOut = sectionsRedirectList;
regExListOut = regExList;
foreach (var item in rootItem.GetChildren().ToArray())
{
if (!item.Publishing.IsPublishable(System.DateTime.Now, true))
{
continue;
}
List<RedirectItem> bufItemsRedirectsList;
List<RedirectItem> bufSectionsRedirectList;
List<RegExItem> bufRegExRedirectList;
CheckRedirectType(item, out bufItemsRedirectsList, out bufSectionsRedirectList, out bufRegExRedirectList);
if (bufItemsRedirectsList != null)
{
itemsRedirectsListOut.AddRange(bufItemsRedirectsList);
}
if (bufSectionsRedirectList != null)
{
sectionsRedirectListOut.AddRange(bufSectionsRedirectList);
}
if (bufRegExRedirectList != null)
{
regExListOut.AddRange(bufRegExRedirectList);
}
ProcessChildren(item, itemsRedirectsList, sectionsRedirectList, regExList, out itemsRedirectsList, out sectionsRedirectList, out regExList);
}
}
示例12: MainWindow_OnClosing
public void MainWindow_OnClosing(object sender, CancelEventArgs e)
{
if (AssembliesWorker.IsBusy && e != null)
{
AssembliesWorker.CancelAsync();
e.Cancel = true;
Hide();
return;
}
try
{
Utility.MapClassToXmlFile(typeof(Config), Config.Instance, Directories.ConfigFilePath);
}
catch
{
MessageBox.Show(Utility.GetMultiLanguageText("ConfigWriteError"));
}
InjectThread?.Abort();
var allAssemblies = new List<LeagueSharpAssembly>();
foreach (var profile in Config.Instance.Profiles)
{
allAssemblies.AddRange(profile.InstalledAssemblies.ToList());
}
Utility.ClearDirectory(Directories.AssembliesDir);
Utility.ClearDirectory(Directories.LogsDir);
GitUpdater.ClearUnusedRepos(allAssemblies);
}
示例13: SearchForIssues
public string SearchForIssues(string[] tags)
{
// If there are no tags provided, the action returns There are no tags provided
if (tags.Length < 0)
{
return "There are no tags provided";
}
var issues = new List<Issue>();
foreach (var tag in tags)
{
issues.AddRange(this.Data.Tag_Issues[tag]);
}
// If there are no matching issues, the action returns There are no issues matching the tags provided
if (!issues.Any())
{
return "There are no issues matching the tags provided";
}
// If an issue matches several tags, it is included only once in the search results.
var uniqueIssues = issues.Distinct();
// In case of success, the action returns the issues sorted by priority (in descending order) first, and by title (in alphabetical order) next.
return string.Join(
Environment.NewLine,
uniqueIssues.OrderByDescending(x => x.Priority).ThenBy(x => x.Title));
}
示例14: InitializeViewModelMetaData
/// <summary>
/// Initializes the view model meta data.
/// <para />
/// This method only initializes the meta data once per view model type. If a type is already initialized,
/// this method will immediately return.
/// </summary>
/// <param name="viewModelType">Type of the view model.</param>
/// <returns>ViewModelMetadata.</returns>
/// <exception cref="ArgumentNullException">The <paramref name="viewModelType" /> is <c>null</c>.</exception>
private static ViewModelMetadata InitializeViewModelMetaData(Type viewModelType)
{
if (_metaData.ContainsKey(viewModelType))
{
return _metaData[viewModelType];
}
var properties = new List<PropertyInfo>();
var bindingFlags = BindingFlagsHelper.GetFinalBindingFlags(true, false, true);
properties.AddRange(viewModelType.GetPropertiesEx(bindingFlags));
var modelObjectsInfo = new Dictionary<string, ModelInfo>();
var viewModelToModelMap = new Dictionary<string, ViewModelToModelMapping>();
var validationSummaries = new Dictionary<string, ValidationToViewModelAttribute>();
foreach (var propertyInfo in properties)
{
#region Model attributes
var modelAttribute = propertyInfo.GetCustomAttributeEx(typeof(ModelAttribute), true) as ModelAttribute;
if (modelAttribute != null)
{
modelObjectsInfo.Add(propertyInfo.Name, new ModelInfo(propertyInfo.Name, modelAttribute));
}
#endregion
#region ViewModelToModel attributes
var viewModelToModelAttribute = propertyInfo.GetCustomAttributeEx(typeof(ViewModelToModelAttribute), true) as ViewModelToModelAttribute;
if (viewModelToModelAttribute != null)
{
if (string.IsNullOrEmpty(viewModelToModelAttribute.Property))
{
// Assume the property name in the model is the same as in the view model
viewModelToModelAttribute.Property = propertyInfo.Name;
}
if (!viewModelToModelMap.ContainsKey(propertyInfo.Name))
{
viewModelToModelMap.Add(propertyInfo.Name, new ViewModelToModelMapping(propertyInfo.Name, viewModelToModelAttribute));
}
}
#endregion
#region ValidationToViewModel attributes
var validationToViewModelAttribute = propertyInfo.GetCustomAttributeEx(typeof(ValidationToViewModelAttribute), true) as ValidationToViewModelAttribute;
if (validationToViewModelAttribute != null)
{
if (propertyInfo.PropertyType != typeof(IValidationSummary))
{
throw Log.ErrorAndCreateException<InvalidOperationException>("A property decorated with the ValidationToViewModel attribute must be of type IValidationSummary, but '{0}' is not", propertyInfo.Name);
}
validationSummaries.Add(propertyInfo.Name, validationToViewModelAttribute);
Log.Debug("Registered property '{0}' as validation summary", propertyInfo.Name);
}
#endregion
}
_metaData.Add(viewModelType, new ViewModelMetadata(viewModelType, modelObjectsInfo, viewModelToModelMap, validationSummaries));
return _metaData[viewModelType];
}
示例15: GetPropertiesSequence
/// <summary>
/// Returns the sequence of properties of the specified type.
/// </summary>
/// <param name="type">The type.</param>
/// <param name="schema">The schema.</param>
/// <param name="schemaSet">The schema set.</param>
/// <param name="serializationManager">The serialization manager.</param>
/// <returns>Sequence containing all properties.</returns>
private static XmlSchemaSequence GetPropertiesSequence(Type type, XmlSchema schema, XmlSchemaSet schemaSet, ISerializationManager serializationManager)
{
Argument.IsNotNull("type", type);
Argument.IsNotNull("schema", schema);
Argument.IsNotNull("schemaSet", schemaSet);
var propertiesSequence = new XmlSchemaSequence();
if (typeof(ModelBase).IsAssignableFromEx(type))
{
var typeNs = GetTypeNamespaceForSchema(type);
var members = new List<MemberInfo>();
members.AddRange(from field in serializationManager.GetFieldsToSerialize(type)
select type.GetFieldEx(field));
members.AddRange(from property in serializationManager.GetPropertiesToSerialize(type)
select type.GetPropertyEx(property));
foreach (var member in members)
{
var propertySchemaElement = new XmlSchemaElement();
propertySchemaElement.Name = member.Name;
var memberType = typeof(object);
var fieldInfo = member as FieldInfo;
if (fieldInfo != null)
{
memberType = fieldInfo.FieldType;
}
var propertyInfo = member as PropertyInfo;
if (propertyInfo != null)
{
memberType = propertyInfo.PropertyType;
}
if (memberType.ImplementsInterfaceEx(typeof(IEnumerable)) && memberType != typeof(string))
{
propertySchemaElement.SchemaTypeName = new XmlQualifiedName(string.Format("{0}", member.Name), typeNs);
var collectionPropertyType = new XmlSchemaComplexType();
collectionPropertyType.Name = string.Format("{0}", member.Name);
schema.Items.Add(collectionPropertyType);
foreach (var genericArgument in memberType.GetGenericArguments())
{
AddTypeToSchemaSet(genericArgument, schemaSet, serializationManager);
}
}
else
{
propertySchemaElement.SchemaTypeName = AddTypeToSchemaSet(memberType, schemaSet, serializationManager);
propertySchemaElement.IsNillable = TypeHelper.IsTypeNullable(memberType);
propertySchemaElement.MinOccurs = 0;
}
propertiesSequence.Items.Add(propertySchemaElement);
}
}
return propertiesSequence;
}