当前位置: 首页>>代码示例>>C#>>正文


C# List.AddRange方法代码示例

本文整理汇总了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);
        }
开发者ID:timbarrass,项目名称:Alembic.Metrics,代码行数:57,代码来源:SimpleComponentBuilder.cs

示例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");
        }
开发者ID:tavenli,项目名称:gaopincai,代码行数:29,代码来源:DmSpan.cs

示例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;
        }
开发者ID:remimarenco,项目名称:BindedIn,代码行数:33,代码来源:RelationService.cs

示例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;
 }
开发者ID:apetrovskiy,项目名称:STUPS,代码行数:10,代码来源:VirtualMachinesSelector.cs

示例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;
 }
开发者ID:apetrovskiy,项目名称:STUPS,代码行数:11,代码来源:VirtualMachinesSelector.cs

示例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;
        }
开发者ID:fedec93,项目名称:Administracion,代码行数:13,代码来源:ControladorEdificios.cs

示例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
            };
        }
开发者ID:mixanj,项目名称:XmlDynamic,代码行数:16,代码来源:Program.cs

示例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;
        }
开发者ID:eddy5641,项目名称:LeagueSharp.Loader,代码行数:17,代码来源:LeagueSharpAssembly.cs

示例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
            };
        }
开发者ID:mixanj,项目名称:XmlDynamic,代码行数:17,代码来源:Program.cs

示例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");
        }
开发者ID:fedec93,项目名称:Administracion,代码行数:19,代码来源:CrearListadoUnidad.cs

示例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);
              }
        }
开发者ID:Eduserv,项目名称:Sitecore-RedirectManager,代码行数:52,代码来源:RedirectProcessor.cs

示例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);
        }
开发者ID:eddy5641,项目名称:LeagueSharp.Loader,代码行数:31,代码来源:MainWindow.xaml.cs

示例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));
        }
开发者ID:EBojilova,项目名称:CSharpHQC,代码行数:28,代码来源:IssueTracker.cs

示例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];
        }
开发者ID:pushist1y,项目名称:Catel,代码行数:71,代码来源:ViewModelBase.cs

示例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;
        }
开发者ID:JaysonJG,项目名称:Catel,代码行数:70,代码来源:XmlSchemaHelper.cs


注:本文中的Data.List.AddRange方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。