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


C# ImmutableArray.First方法代码示例

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


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

示例1: CompositeText

        public CompositeText(ImmutableArray<SourceText> texts)
            : base(checksumAlgorithm: texts[0].ChecksumAlgorithm)
        {
            Debug.Assert(!texts.IsDefaultOrEmpty);
            Debug.Assert(texts.All(t => texts.First().Encoding == t.Encoding && texts.First().ChecksumAlgorithm == t.ChecksumAlgorithm));

            _texts = texts;
            int len = 0;
            foreach (var text in texts)
            {
                len += text.Length;
            }

            _length = len;
        }
开发者ID:GloryChou,项目名称:roslyn,代码行数:15,代码来源:CompositeText.cs

示例2: CompleteTodoReducer

        public static ImmutableArray<Todo> CompleteTodoReducer(ImmutableArray<Todo> previousState, CompleteTodoAction action)
        {
            var todoToEdit = previousState.First(todo => todo.Id == action.TodoId);

            return previousState
                .Replace(todoToEdit, new Todo
                {
                    Id = todoToEdit.Id,
                    Text = todoToEdit.Text,
                    IsCompleted = !todoToEdit.IsCompleted
                });
        }
开发者ID:autechr3,项目名称:redux.NET,代码行数:12,代码来源:ApplicationReducer.cs

示例3: CompositeText

        public CompositeText(ImmutableArray<SourceText> texts)
        {
            Debug.Assert(!texts.IsDefaultOrEmpty);
            Debug.Assert(texts.All(t => texts.First().Encoding == t.Encoding));

            this.texts = texts;
            int len = 0;
            foreach (var text in texts)
            {
                len += text.Length;
            }

            this.length = len;
        }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:14,代码来源:CompositeText.cs

示例4: GetOverloadCount

 private static int GetOverloadCount(ImmutableArray<ISymbol> symbolGroup)
 {
     return symbolGroup.Select(s => s.OriginalDefinition)
                       .Where(s => !s.Equals(symbolGroup.First().OriginalDefinition))
                       .Where(s => s is IMethodSymbol || s.IsIndexer())
                       .Count();
 }
开发者ID:jkotas,项目名称:roslyn,代码行数:7,代码来源:AbstractSymbolDisplayService.AbstractSymbolDescriptionBuilder.cs

示例5: GetUsingActions

        private async Task<IEnumerable<CodeActionOperation>> GetUsingActions(ICodeActionProvider codeActionProvider,
                ImmutableArray<Diagnostic> pointDiagnostics, string actionPrefix)
        {
            var actions = new List<CodeAction>();
            var context = new CodeFixContext(_document, pointDiagnostics.First().Location.SourceSpan, pointDiagnostics, (a, d) => actions.Add(a), CancellationToken.None);
            var providers = codeActionProvider.CodeFixes;

            //Disable await warning since we dont need the result of the call. Else we need to use a throwaway variable.
#pragma warning disable 4014
            foreach (var provider in providers)
            {
                provider.RegisterCodeFixesAsync(context);
            }
#pragma warning restore 4014

            var tasks = actions.Where(a => a.Title.StartsWith(actionPrefix))
                    .Select(async a => await a.GetOperationsAsync(CancellationToken.None)).ToList();

            return (await Task.WhenAll(tasks)).SelectMany(x => x);
        }
开发者ID:GeeBook,项目名称:omnisharp-roslyn,代码行数:20,代码来源:FixUsings.cs

示例6: DeleteTodoReducer

        public static ImmutableArray<Todo> DeleteTodoReducer(ImmutableArray<Todo> previousState, DeleteTodoAction action)
        {
            var todoToDelete = previousState.First(todo => todo.Id == action.TodoId);

            return previousState.Remove(todoToDelete);
        }
开发者ID:autechr3,项目名称:redux.NET,代码行数:6,代码来源:ApplicationReducer.cs

示例7: CreateInvocableCompletionGroup

        private static CompletionItem CreateInvocableCompletionGroup(ImmutableArray<Symbol> symbols)
        {
            var symbol = symbols.First();
            var first = CreateSymbolCompletion(symbol);
            var numberOfOverloads = symbols.Count() - 1;

            var displayText = first.DisplayText;
            var insertionText = first.InsertionText;
            var description = string.Format(Resources.CompletionItemWithOverloads, first.Description, numberOfOverloads);
            if (!string.IsNullOrEmpty(symbol.Documentation))
                description += Environment.NewLine + symbol.Documentation;
            var glyph = first.Glyph;
            return new CompletionItem(displayText, insertionText, description, glyph, symbol);
        }
开发者ID:Samana,项目名称:HlslTools,代码行数:14,代码来源:SymbolCompletionProvider.cs

示例8: CreateSymbolCompletionGroup

        private static CompletionItem CreateSymbolCompletionGroup(string name, ImmutableArray<Symbol> symbols)
        {
            var multiple = symbols.Skip(1).Any();
            if (!multiple)
                return CreateSymbolCompletion(symbols.First());

            var hasNonInvocables = symbols.Any(s => !(s is InvocableSymbol));
            if (!hasNonInvocables)
                return CreateInvocableCompletionGroup(symbols);

            var displayText = name;
            var insertionText = name;

            var sb = new StringBuilder();
            sb.Append(Resources.AmbiguousName);
            foreach (var symbol in symbols)
            {
                sb.AppendLine();
                sb.Append(@"  ");
                sb.Append(symbol);
            }

            var description = sb.ToString();
            return new CompletionItem(displayText, insertionText, description, Glyph.CompletionWarning);
        }
开发者ID:Samana,项目名称:HlslTools,代码行数:25,代码来源:SymbolCompletionProvider.cs

示例9: GetFigureFromPoints

        private static PathFigure GetFigureFromPoints(ImmutableArray<PortablePoint> points)
        {
            var figure = new PathFigure();

            figure.StartPoint = points.First().ToPoint();

            foreach (var segment in points.Skip(1).Select(p => new LineSegment() { Point = p.ToPoint() }))
            {
                figure.Segments.Add(segment);
            }
            return figure;
        }
开发者ID:imanushin,项目名称:ColorsMagic,代码行数:12,代码来源:GameView.xaml.cs


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