本文整理汇总了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;
}
}
示例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();
}
示例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();
}
}
示例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();
}
}
示例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();
}
}