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


C# ImmutableArray.SelectAsArray方法代码示例

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


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

示例1: ProcessResult

 private static ImmutableArray<INavigateToSearchResult> ProcessResult(
     string searchPattern,
     ImmutableArray<ValueTuple<DeclaredSymbolInfo, Document, IEnumerable<PatternMatch>>> results)
 {
     var containsDots = searchPattern.IndexOf('.') >= 0;
     return results.SelectAsArray(r => ConvertResult(containsDots, r));
 }
开发者ID:tralivali1234,项目名称:roslyn,代码行数:7,代码来源:DefaultNavigateToEngineService.cs

示例2: Convert

 internal static ImmutableArray<CustomModifier> Convert(ImmutableArray<Metadata.PE.MetadataDecoder.ModifierInfo> customModifiers)
 {
     if (customModifiers.IsDefault)
     {
         return ImmutableArray<CustomModifier>.Empty;
     }
     return customModifiers.SelectAsArray(Convert);
 }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:8,代码来源:CustomModifier.cs

示例3: Convert

 internal static ImmutableArray<CustomModifier> Convert(ImmutableArray<ModifierInfo<TypeSymbol>> customModifiers)
 {
     if (customModifiers.IsDefault)
     {
         return ImmutableArray<CustomModifier>.Empty;
     }
     return customModifiers.SelectAsArray(Convert);
 }
开发者ID:iolevel,项目名称:peachpie,代码行数:8,代码来源:CustomModifier.cs

示例4: ConstructedMethodSymbol

 internal ConstructedMethodSymbol(MethodSymbol constructedFrom, ImmutableArray<TypeSymbol> typeArguments)
     : base(containingSymbol: constructedFrom.ContainingType,
            map: new TypeMap(constructedFrom.ContainingType, ((MethodSymbol)constructedFrom.OriginalDefinition).TypeParameters, typeArguments.SelectAsArray(TypeMap.TypeSymbolAsTypeWithModifiers)),
            originalDefinition: (MethodSymbol)constructedFrom.OriginalDefinition,
            constructedFrom: constructedFrom)
 {
     _typeArguments = typeArguments;
 }
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:8,代码来源:ConstructedMethodSymbol.cs

示例5: RewriteConstructor

        internal static BoundTypeOrInstanceInitializers RewriteConstructor(ImmutableArray<BoundInitializer> boundInitializers, MethodSymbol method)
        {
            Debug.Assert(!boundInitializers.IsDefault);
            Debug.Assert((method.MethodKind == MethodKind.Constructor) || (method.MethodKind == MethodKind.StaticConstructor));

            var sourceMethod = method as SourceMethodSymbol;
            var syntax = ((object)sourceMethod != null) ? sourceMethod.SyntaxNode : method.GetNonNullSyntaxNode();
            return new BoundTypeOrInstanceInitializers(syntax, boundInitializers.SelectAsArray(RewriteInitializersAsStatements));
        }
开发者ID:rgani,项目名称:roslyn,代码行数:9,代码来源:InitializerRewriter.cs

示例6: LocalSlotMapBuilder

 private LocalSlotMapBuilder(
     ImmutableArray<string> localNames,
     ImmutableArray<MetadataDecoder.LocalInfo> localInfo,
     Dictionary<EncLocalInfo, int> locals)
 {
     this.localNames = localNames.SelectAsArray(ParseName);
     this.localInfo = localInfo;
     this.locals = locals;
     this.slotIndex = 0;
 }
开发者ID:pheede,项目名称:roslyn,代码行数:10,代码来源:CSharpDefinitionMap.LocalVisitors.cs

示例7: LambdaSymbol

 private LambdaSymbol(
     Symbol containingSymbol,
     ImmutableArray<ParameterSymbol> parameters,
     TypeSymbol returnType,
     MessageID messageID,
     CSharpSyntaxNode syntax,
     bool isSynthesized,
     bool isAsync)
 {
     this.containingSymbol = containingSymbol;
     this.messageID = messageID;
     this.syntax = syntax;
     this.returnType = returnType;
     this.isSynthesized = isSynthesized;
     this.isAsync = isAsync;
     this.parameters = parameters.SelectAsArray(CopyParameter, this);
 }
开发者ID:afrog33k,项目名称:csnative,代码行数:17,代码来源:LambdaSymbol.cs

示例8: LambdaSymbol

 public LambdaSymbol(
     Symbol containingSymbol,
     ImmutableArray<ParameterSymbol> parameters,
     RefKind refKind,
     TypeSymbol returnType,
     MessageID messageID,
     CSharpSyntaxNode syntax,
     bool isSynthesized)
 {
     _containingSymbol = containingSymbol;
     _messageID = messageID;
     _syntax = syntax;
     _refKind = refKind;
     _returnType = returnType;
     _isSynthesized = isSynthesized;
     _parameters = parameters.SelectAsArray(CopyParameter, this);
 }
开发者ID:Rickinio,项目名称:roslyn,代码行数:17,代码来源:LambdaSymbol.cs

示例9: ConstructedNamedTypeSymbol

        internal ConstructedNamedTypeSymbol(NamedTypeSymbol constructedFrom, ImmutableArray<TypeWithModifiers> typeArguments, bool unbound = false)
            : base(newContainer: constructedFrom.ContainingSymbol,
                   map: new TypeMap(constructedFrom.ContainingType, constructedFrom.OriginalDefinition.TypeParameters, typeArguments),
                   originalDefinition: constructedFrom.OriginalDefinition,
                   constructedFrom: constructedFrom, unbound: unbound)
        {
            bool hasTypeArgumentsCustomModifiers = false;
            _typeArguments = typeArguments.SelectAsArray(a => 
                                                            {
                                                                if (!a.CustomModifiers.IsDefaultOrEmpty)
                                                                {
                                                                    hasTypeArgumentsCustomModifiers = true;
                                                                }

                                                                return a.Type;
                                                            });
            _hasTypeArgumentsCustomModifiers = hasTypeArgumentsCustomModifiers;
            _constructedFrom = constructedFrom;

            Debug.Assert(constructedFrom.Arity == typeArguments.Length);
            Debug.Assert(constructedFrom.Arity != 0);
        }
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:22,代码来源:ConstructedNamedTypeSymbol.cs

示例10: TypeMap

 // Only when the caller passes allowAlpha=true do we tolerate substituted (alpha-renamed) type parameters as keys
 internal TypeMap(ImmutableArray<TypeParameterSymbol> from, ImmutableArray<TypeParameterSymbol> to, bool allowAlpha = false)
     : this(from, to.SelectAsArray(TypeSymbolAsTypeWithModifiers), allowAlpha)
 {
     // mapping contents are read-only hereafter
 }
开发者ID:iolevel,项目名称:peachpie,代码行数:6,代码来源:TypeMap.cs

示例11: SubstituteTypeParameters

 internal ImmutableArray<TypeParameterSymbol> SubstituteTypeParameters(ImmutableArray<TypeParameterSymbol> original)
 {
     return original.SelectAsArray((tp, m) => (TypeParameterSymbol)m.SubstituteTypeParameter(tp).AsTypeSymbolOnly(), this);
 }
开发者ID:iolevel,项目名称:peachpie,代码行数:4,代码来源:AbstractTypeMap.cs

示例12: GetLocalInfo

        internal override ImmutableArray<EncLocalInfo> GetLocalInfo(
            Cci.IMethodDefinition methodDef,
            ImmutableArray<LocalDefinition> localDefs)
        {
            if (localDefs.IsEmpty)
            {
                return ImmutableArray<EncLocalInfo>.Empty;
            }

            // Find declarators in current method syntax.
            var declarators = LocalVariableDeclaratorsCollector.GetDeclarators((MethodSymbol)methodDef);

            // Create a map from declarator to declarator index.
            var declaratorToIndex = CreateDeclaratorToIndexMap(declarators);

            return localDefs.SelectAsArray(localDef => GetLocalInfo(declaratorToIndex, localDef));
        }
开发者ID:pheede,项目名称:roslyn,代码行数:17,代码来源:CSharpDefinitionMap.cs

示例13: ProcessParameterlessCrefMemberLookupResults

        /// <summary>
        /// At this point, we have a list of viable symbols and no parameter list with which to perform
        /// overload resolution.  We'll just return the first symbol, giving a diagnostic if there are
        /// others.
        /// Caveat: If there are multiple candidates and only one is from source, then the source symbol
        /// wins and no diagnostic is reported.
        /// </summary>
        private ImmutableArray<Symbol> ProcessParameterlessCrefMemberLookupResults(
            ImmutableArray<Symbol> symbols,
            int arity,
            MemberCrefSyntax memberSyntax,
            TypeArgumentListSyntax typeArgumentListSyntax,
            out Symbol ambiguityWinner,
            DiagnosticBag diagnostics)
        {
            // If the syntax indicates arity zero, then we match methods of any arity.
            // However, if there are both generic and non-generic methods, then the
            // generic methods should be ignored.
            if (symbols.Length > 1 && arity == 0)
            {
                bool hasNonGenericMethod = false;
                bool hasGenericMethod = false;
                foreach (Symbol s in symbols)
                {
                    if (s.Kind != SymbolKind.Method)
                    {
                        continue;
                    }

                    if (((MethodSymbol)s).Arity == 0)
                    {
                        hasNonGenericMethod = true;
                    }
                    else
                    {
                        hasGenericMethod = true;
                    }

                    if (hasGenericMethod && hasNonGenericMethod)
                    {
                        break; //Nothing else to be learned.
                    }
                }

                if (hasNonGenericMethod && hasGenericMethod)
                {
                    symbols = symbols.WhereAsArray(s =>
                        s.Kind != SymbolKind.Method || ((MethodSymbol)s).Arity == 0);
                }
            }

            Debug.Assert(!symbols.IsEmpty);

            Symbol symbol = symbols[0];

            // If there's ambiguity, prefer source symbols.
            // Logic is similar to ResultSymbol, but separate because the error handling is totally different.
            if (symbols.Length > 1)
            {
                // Size is known, but IndexOfSymbolFromCurrentCompilation expects a builder.
                ArrayBuilder<Symbol> unwrappedSymbols = ArrayBuilder<Symbol>.GetInstance(symbols.Length);

                foreach (Symbol wrapped in symbols)
                {
                    unwrappedSymbols.Add(UnwrapAliasNoDiagnostics(wrapped));
                }

                BestSymbolInfo secondBest;
                BestSymbolInfo best = GetBestSymbolInfo(unwrappedSymbols, out secondBest);

                Debug.Assert(!best.IsNone);
                Debug.Assert(!secondBest.IsNone);

                unwrappedSymbols.Free();

                int symbolIndex = 0;

                if (best.IsFromCompilation)
                {
                    symbolIndex = best.Index;
                    symbol = symbols[symbolIndex]; // NOTE: symbols, not unwrappedSymbols.
                }

                if (symbol.Kind == SymbolKind.TypeParameter)
                {
                    CrefSyntax crefSyntax = GetRootCrefSyntax(memberSyntax);
                    diagnostics.Add(ErrorCode.WRN_BadXMLRefTypeVar, crefSyntax.Location, crefSyntax.ToString());
                }
                else if (secondBest.IsFromCompilation == best.IsFromCompilation)
                {
                    CrefSyntax crefSyntax = GetRootCrefSyntax(memberSyntax);
                    int otherIndex = symbolIndex == 0 ? 1 : 0;
                    diagnostics.Add(ErrorCode.WRN_AmbiguousXMLReference, crefSyntax.Location, crefSyntax.ToString(), symbol, symbols[otherIndex]);

                    ambiguityWinner = ConstructWithCrefTypeParameters(arity, typeArgumentListSyntax, symbol);
                    return symbols.SelectAsArray(sym => ConstructWithCrefTypeParameters(arity, typeArgumentListSyntax, sym));
                }
            }
            else if (symbol.Kind == SymbolKind.TypeParameter)
            {
//.........这里部分代码省略.........
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:101,代码来源:Binder_Crefs.cs

示例14: AssemblyMetadata

 internal AssemblyMetadata(ImmutableArray<ModuleMetadata> modules)
 {
     this.Modules = modules;
     this.Assembly = new PEAssembly(this, modules.SelectAsArray(m => m.Module));
 }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:5,代码来源:AssemblyMetadata.cs

示例15: MakeTempsForDiscardArguments

        internal ImmutableArray<BoundExpression> MakeTempsForDiscardArguments(ImmutableArray<BoundExpression> arguments, ArrayBuilder<LocalSymbol> builder)
        {
            var discardsCount = arguments.Count(a => a.Kind == BoundKind.DiscardExpression);

            if (discardsCount != 0)
            {
                arguments = arguments.SelectAsArray(
                    (arg, t) => arg.Kind == BoundKind.DiscardExpression ?  t.factory.MakeTempForDiscard((BoundDiscardExpression)arg, t.builder) : arg,
                    (factory: this, builder: builder));
            }

            return arguments;
        }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:13,代码来源:SyntheticBoundNodeFactory.cs


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