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


C# Collection.ToList方法代码示例

本文整理汇总了C#中Collection.ToList方法的典型用法代码示例。如果您正苦于以下问题:C# Collection.ToList方法的具体用法?C# Collection.ToList怎么用?C# Collection.ToList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Collection的用法示例。


在下文中一共展示了Collection.ToList方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ConvertToAbsoluteCoordinates

        private static List<AbsoluteBlock> ConvertToAbsoluteCoordinates(this RawShapeBlocksGroup elem)
        {
            var offsetX = 0;

            var absoluteBlockCollection = new Collection<AbsoluteBlock>();

            RawShapeBlock previousRawShapeBlock = null;

            foreach (var block in elem.Collection)
            {
                if (previousRawShapeBlock != null)
                {
                    offsetX += previousRawShapeBlock.Length;
                }

                offsetX += block.Offsetx;

                previousRawShapeBlock = block;

                var absoluteBlock = new AbsoluteBlock(offsetX, block.Length, elem.RowIndex);

                absoluteBlockCollection.Add(absoluteBlock);
            }

            return absoluteBlockCollection.ToList();
        }
开发者ID:klym1,项目名称:Gpak-tools,代码行数:26,代码来源:MultiPictureElAbsoluteCoordinatesConverter.cs

示例2: LineString

 /// <summary>
 ///     Initializes an instance of a LineString
 /// </summary>
 /// <param name="points"></param>
 public LineString(IEnumerable<double[]> points)
 {
     var vertices = new Collection<Point>();
     foreach (var point in points)
     {
         vertices.Add(new Point(point));
     }
     Vertices = vertices.ToList();
 }
开发者ID:pauldendulk,项目名称:Mapsui,代码行数:13,代码来源:LineString.cs

示例3: PlatformApplication

        static PlatformApplication()
        {
            var applications = new Collection<PlatformApplication>();
            ConfigureApplications(applications);
            AllApplications = applications.ToList().AsReadOnly();

            UnknownApplication = new PlatformApplication("[Unknown]");
            Current = GetCurrentApplication();
        }
开发者ID:paulkearney,项目名称:brnkly,代码行数:9,代码来源:PlatformApplication.cs

示例4: CasoDeTeste

        /// <summary>
        /// Construtor default
        /// </summary>
        protected CasoDeTeste()
        {
            id = this.GetType().FullName.ToString();
            comandos = MontarListaComandos();

            //Força a aplicação do método Executar no comando do tipo Code da Lista
            ((CodeCommand)comandos.ToList().Where(c => c.CommandType == CommandType.Code).First()).FunctionToExecute = Executar;

            TempoEsperaDefault = 5000;

            this.Assert = new RealAssert();
        }
开发者ID:Workker,项目名称:EntregaRergressaoTestes,代码行数:15,代码来源:CasoDeTeste.cs

示例5: GetDistributedCounterPartBlocksInternal

        public Collection<AbsoluteBlockContainer> GetDistributedCounterPartBlocksInternal(List<AbsoluteBlock> piactureElements, Collection<RawColorBlock> secondPartBlocks)
        {
            if (secondPartBlocks.Count == 0) return new Collection<AbsoluteBlockContainer>();

            _enumerator = secondPartBlocks.ToList().GetEnumerator();
            _blockEnumerator = piactureElements.ToList().GetEnumerator();

            var blockContainerCollection = new Collection<AbsoluteBlockContainer>();

            var currentCounterBlock = FetchCounterBlock();

            var currentBlock = FetchBlock();
            var currentBlockContainer = new AbsoluteBlockContainer(currentBlock);
            blockContainerCollection.Add(currentBlockContainer);

            var blockLengthNeeded = GetBlockLengthNeeded(currentCounterBlock);

            while (true)
            {
                int lengthAdded;

                if (TryToAppendCounterBlock(currentBlockContainer, currentCounterBlock, blockLengthNeeded, out lengthAdded))
                {
                    currentCounterBlock = FetchCounterBlock();
                    if (currentCounterBlock == null) break;
                    blockLengthNeeded = GetBlockLengthNeeded(currentCounterBlock);
                }
                else
                {
                    currentBlock = FetchBlock();
                    if (currentBlock == null) break;
                    currentBlockContainer = new AbsoluteBlockContainer(currentBlock);
                    blockContainerCollection.Add(currentBlockContainer);

                    blockLengthNeeded -= lengthAdded;
                }
            }

            _enumerator.Dispose();
            _blockEnumerator.Dispose();

            return blockContainerCollection;
        }
开发者ID:klym1,项目名称:Gpak-tools,代码行数:43,代码来源:BlocksDistributor.cs

示例6: PublishWorkflow

        public static void PublishWorkflow(this WorkflowManagementClient client, string workflowName, string xamlFilePath, Collection<ExternalVariable> externalVariables, IDictionary<string, string> configValues, SubscriptionFilter activationFilter = null)
        {
            // publish the activity description related with the workflow
            client.Activities.Publish(
                new ActivityDescription(WorkflowUtils.Translate(xamlFilePath)) { Name = workflowName },true,true);

            // now, publish the workflow description
            WorkflowDescription description = new WorkflowDescription
            {
                Name = workflowName,
                ActivityPath = workflowName,
            };

            // add external variables
            if (externalVariables != null)
            {
                externalVariables
                    .ToList()
                    .ForEach(ev => description.ExternalVariables.Add(ev));
            }

            // add config
            if (configValues != null)
            {
                description.Configuration = new WorkflowConfiguration();
                configValues
                    .ToList()
                    .ForEach(c => description.Configuration.AppSettings.Add(c));
            }

            // add activation filter
            if (activationFilter != null)
            {
                description.ActivationDescription = new SubscriptionActivationDescription
                {
                    Filter = activationFilter
                };
            }

            // publish!
            client.Workflows.Publish(description);
        }
开发者ID:InFlowBPM,项目名称:InFlow-BPMS,代码行数:42,代码来源:WorkflowManagementClientExtensions.cs

示例7: Prompt

        public override Dictionary<string, PSObject> Prompt(string caption, string message,
                                                            Collection<FieldDescription> descriptions)
        {
            _control.WriteLine(String.Empty);
            _control.WriteLine(caption);
            _control.WriteLine(message);

            var results = new Dictionary<string, PSObject>();

            descriptions.ToList().ForEach(
                d =>
                    {
                        var prompt = (d.Label + ": ").Replace("&", String.Empty);
                        _control.WritePrompt(prompt);
                        _control.CommandEnteredEvent.WaitOne();

                        results[d.Name] = _control.ReadLine().Trim().ToPSObject();
                    }
                );

            return results;
        }
开发者ID:beefarino,项目名称:NHibernate-QuickStart,代码行数:22,代码来源:HostUI.cs

示例8: PopulateColumns

        /// <summary>
        /// Populates columns with the view model column 
        /// property and rebinds the columns
        /// </summary>
        /// <param name="selectedLayerMap">Selected layer map</param>
        /// <param name="columns">Collection of columns</param>
        internal void PopulateColumns(LayerMap selectedLayerMap, Collection<Column> columns)
        {
            this.ColumnsView = new ObservableCollection<ColumnViewModel>();
            int index = 0;

            foreach (string headerData in selectedLayerMap.HeaderRowData)
            {
                ColumnViewModel columnViewModel = new ColumnViewModel();
                columnViewModel.ExcelHeaderColumn = headerData;
                columnViewModel.WWTColumns = new ObservableCollection<Column>();
                columns.ToList().ForEach(col => columnViewModel.WWTColumns.Add(col));
                columnViewModel.SelectedWWTColumn = columns.Where(column => column.ColType == selectedLayerMap.MappedColumnType[index]).FirstOrDefault() ?? columns.Where(column => column.ColType == ColumnType.None).FirstOrDefault();
                this.ColumnsView.Add(columnViewModel);
                index++;
            }
            SetRAUnitVisibility();
        }
开发者ID:rat-s-tar,项目名称:wwt-excel-plugin,代码行数:23,代码来源:LayerDetailsViewModel.cs

示例9: PromptForChoice

        public override int PromptForChoice(string caption, string message, Collection<ChoiceDescription> choices,
                                            int defaultChoice)
        {
            _control.WriteWarningLine(caption);
            _control.WriteLine(message);

            while (true)
            {
                int choiceIndex = 0;
                string defaultChoicePrompt = String.Empty;
                List<char> hotkeys = new List<char>();
                choices.ToList().ForEach(
                    choice =>
                        {
                            var index = choice.Label.IndexOf('&') + 1;
                            if (-1 == index || index > (choice.Label.Length - 1))
                            {
                                return;
                            }
                            var c = choice.Label.ToUpperInvariant()[index];
                            hotkeys.Add(c);

                            ConsoleColor color = _settings.ForegroundColor;
                            ConsoleColor back = _settings.BackgroundColor;

                            if (choiceIndex == defaultChoice)
                            {
                                color = _settings.WarningForegroundColor;
                                back = _settings.WarningBackgroundColor;
                                defaultChoicePrompt = String.Format(" (default is \"{0}\")", c);
                            }

                            _control.Write(
                                String.Format("[{0}]", c),
                                color,
                                _control.ConsoleBackColor);

                            _control.Write(String.Format(" {0}  ", choice.Label.Replace("&", String.Empty)), color, back);
                            ++choiceIndex;
                        }
                    );

                _control.WritePrompt(String.Format(" [?] Help{0}:", defaultChoicePrompt));

                _control.CommandEnteredEvent.WaitOne();

                var line = _control.ReadLine().Trim();
                if (line.Length == 0)
                {
                    if (-1 == defaultChoice)
                    {
                        continue;
                    }
                    return defaultChoice;
                }

                char charChoice = line.ToUpperInvariant()[0];

                if ('?' == charChoice)
                {
                    choices.ToList().ForEach(
                        choice => _control.WriteLine(
                            String.Format(
                                " {0} - {1}",
                                choice.Label.Replace("&", String.Empty),
                                choice.HelpMessage)
                                      ));
                    continue;
                }

                choiceIndex = hotkeys.IndexOf(charChoice);
                if (-1 == choiceIndex)
                {
                    continue;
                }
                return choiceIndex;
            }
        }
开发者ID:beefarino,项目名称:NHibernate-QuickStart,代码行数:78,代码来源:HostUI.cs

示例10: Prompt

        public override Dictionary<string, PSObject> Prompt(string caption, string message,
                                                            Collection<FieldDescription> descriptions)
        {
            _control.WriteLine(String.Empty);

            if( ! String.IsNullOrEmpty( caption ) )
            {
                _control.WriteLine(caption);
            }
            if (!String.IsNullOrEmpty(message))
            {
                _control.WriteLine(message);
            }

            var results = new Dictionary<string, PSObject>();

            descriptions.ToList().ForEach(
                d =>
                    {
                        bool isSecure = d.ParameterTypeFullName == typeof (SecureString).FullName;

                        var label = String.IsNullOrEmpty( d.Label ) ? d.Name : d.Label;
                        var prompt = (label + ": ").Replace("&", String.Empty);
                        _control.WritePrompt(prompt);
                        
                        if (isSecure)
                        {
                            results[d.Name] = ReadLineAsSecureString().ToPSObject();
                        }
                        else
                        {
                            _control.CommandEnteredEvent.WaitOne();
                            results[d.Name] = _control.ReadLine().Trim().ToPSObject();                            
                        }
                    }
                );

            return results;
        }
开发者ID:beefarino,项目名称:bips,代码行数:39,代码来源:HostUI.cs

示例11: TrimAttributes

 void TrimAttributes(Collection<CustomAttribute> customAttributes)
 {
     foreach (var customAttribute in customAttributes.ToList())
     {
         if (allAttributes.Contains(customAttribute.AttributeType.Name))
         {
             customAttributes.Remove(customAttribute);
         }
     }
 }
开发者ID:blairconrad,项目名称:JetBrainsAnnotations,代码行数:10,代码来源:ModuleWeaver.cs

示例12: Visit

            public override void Visit(Collection<MethodDefinition> methodDefinitionCollection)
            {
                var snapshot = methodDefinitionCollection.ToList();
                foreach (var method in snapshot) {

                  if (method.IsPropertyAccessor()) {
                continue;
                  }

                  if (method.IsEventAccessor()) {
                continue;
                  }

                  MorphMethod(method);
                }
            }
开发者ID:cessationoftime,项目名称:nroles,代码行数:16,代码来源:MorphIntoInterfaceMutator.cs

示例13: InitializeSpellCheck

 public void InitializeSpellCheck(Collection<string> parameterNames, SelectionType selectionType)
 {
     if (parameterNames != null)
     {
         m_selectedParameterNames = parameterNames.ToList<string>();
     }
     else
     {
         throw new ArgumentException("Null parameter names list");
     }
     m_selectionType = selectionType;
 }
开发者ID:curlymorphic,项目名称:RevitParameterSpellCheck,代码行数:12,代码来源:Repository.cs


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