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


C# ParameterSymbol.AsImmutableOrNull方法代码示例

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


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

示例1: AnonymousTypeConstructorSymbol

 internal AnonymousTypeConstructorSymbol(NamedTypeSymbol container, ImmutableArray<AnonymousTypePropertySymbol> properties)
     : base(container, WellKnownMemberNames.InstanceConstructorName)
 {
     // Create constructor parameters
     int fieldsCount = properties.Length;
     if (fieldsCount > 0)
     {
         ParameterSymbol[] paramsArr = new ParameterSymbol[fieldsCount];
         for (int index = 0; index < fieldsCount; index++)
         {
             PropertySymbol property = properties[index];
             paramsArr[index] = new SynthesizedParameterSymbol(this, property.Type, index, RefKind.None, property.Name);
         }
         _parameters = paramsArr.AsImmutableOrNull();
     }
     else
     {
         _parameters = ImmutableArray<ParameterSymbol>.Empty;
     }
 }
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:20,代码来源:AnonymousType.ConstructorSymbol.cs

示例2: InvokeMethod

            internal InvokeMethod(SynthesizedDelegateSymbol containingType, BitVector byRefParameters, TypeSymbol voidReturnTypeOpt)
            {
                var typeParams = containingType.TypeParameters;

                _containingType = containingType;

                // if we are given Void type the method returns Void, otherwise its return type is the last type parameter of the delegate:
                _returnType = voidReturnTypeOpt ?? typeParams.Last();

                var parameters = new ParameterSymbol[typeParams.Length - ((object)voidReturnTypeOpt != null ? 0 : 1)];
                for (int i = 0; i < parameters.Length; i++)
                {
                    // we don't need to distinguish between out and ref since this is an internal synthesized symbol:
                    var refKind = !byRefParameters.IsNull && byRefParameters[i] ? RefKind.Ref : RefKind.None;

                    parameters[i] = SynthesizedParameterSymbol.Create(this, typeParams[i], i, refKind);
                }

                _parameters = parameters.AsImmutableOrNull();
            }
开发者ID:GuilhermeSa,项目名称:roslyn,代码行数:20,代码来源:SynthesizedDelegateSymbol.cs

示例3: MakeParameters

        private ImmutableArray<ParameterSymbol> MakeParameters()
        {
            var reducedFromParameters = this.reducedFrom.Parameters;
            int count = reducedFromParameters.Length;

            if (count <= 1)
            {
                Debug.Assert(count == 1);
                return ImmutableArray<ParameterSymbol>.Empty;
            }
            else
            {
                var parameters = new ParameterSymbol[count - 1];
                for (int i = 0; i < count - 1; i++)
                {
                    parameters[i] = new ReducedExtensionMethodParameterSymbol(this, reducedFromParameters[i + 1]);
                }

                return parameters.AsImmutableOrNull();
            }
        }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:21,代码来源:ReducedExtensionMethodSymbol.cs

示例4: RetargetParameters

        private ImmutableArray<ParameterSymbol> RetargetParameters()
        {
            var list = this.underlyingMethod.Parameters;
            int count = list.Length;

            if (count == 0)
            {
                return ImmutableArray<ParameterSymbol>.Empty;
            }
            else
            {
                ParameterSymbol[] parameters = new ParameterSymbol[count];

                for (int i = 0; i < count; i++)
                {
                    parameters[i] = new RetargetingMethodParameterSymbol(this, list[i]);
                }

                return parameters.AsImmutableOrNull();
            }
        }
开发者ID:riversky,项目名称:roslyn,代码行数:21,代码来源:RetargetingMethodSymbol.cs

示例5: SubstituteParameters

        private ImmutableArray<ParameterSymbol> SubstituteParameters()
        {
            var unsubstitutedParameters = OriginalDefinition.Parameters;

            if (unsubstitutedParameters.IsEmpty)
            {
                return unsubstitutedParameters;
            }
            else
            {
                int count = unsubstitutedParameters.Length;
                var substituted = new ParameterSymbol[count];
                for (int i = 0; i < count; i++)
                {
                    substituted[i] = new SubstitutedParameterSymbol(this, _containingType.TypeSubstitution, unsubstitutedParameters[i]);
                }
                return substituted.AsImmutableOrNull();
            }
        }
开发者ID:GuilhermeSa,项目名称:roslyn,代码行数:19,代码来源:SubstitutedPropertySymbol.cs


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