本文整理汇总了C#中Microsoft.CodeAnalysis.CSharp.Syntax.MethodDeclarationSyntax.WithParameterList方法的典型用法代码示例。如果您正苦于以下问题:C# MethodDeclarationSyntax.WithParameterList方法的具体用法?C# MethodDeclarationSyntax.WithParameterList怎么用?C# MethodDeclarationSyntax.WithParameterList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.CodeAnalysis.CSharp.Syntax.MethodDeclarationSyntax
的用法示例。
在下文中一共展示了MethodDeclarationSyntax.WithParameterList方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateIEnumerableFromParamsArrayMethod
internal static MethodDeclarationSyntax CreateIEnumerableFromParamsArrayMethod(MetaField field, MethodDeclarationSyntax paramsArrayMethod)
{
return paramsArrayMethod
.WithParameterList(SyntaxFactory.ParameterList(SyntaxFactory.SingletonSeparatedList(
SyntaxFactory.Parameter(ValuesParameterName.Identifier)
.WithType(Syntax.IEnumerableOf(GetFullyQualifiedSymbolName(field.ElementType))))));
}
示例2: AppendParameterToMethod
public static MethodDeclarationSyntax AppendParameterToMethod(MethodDeclarationSyntax method,
ParameterSyntax parameter)
{
if (method.ParameterList.Parameters.Any())
{
parameter = parameter.WithLeadingTrivia(SF.Space);
}
return method.WithParameterList(method.ParameterList.AddParameters(parameter));
}
示例3: UpdateClassToUseNewParameterClass
private static ClassDeclarationSyntax UpdateClassToUseNewParameterClass(string className, ClassDeclarationSyntax classOld, MethodDeclarationSyntax methodOld)
{
var newParameter = SyntaxFactory.Parameter(SyntaxFactory.Identifier(FirstLetteToLower(className))).WithType(SyntaxFactory.ParseTypeName(className));
var parameters = SyntaxFactory.ParameterList(SyntaxFactory.SeparatedList<ParameterSyntax>().Add(newParameter));
var newMethod = methodOld.WithParameterList(parameters);
var newClass = classOld.ReplaceNode(methodOld, newMethod);
return newClass;
}
示例4: RemoveOutParameter
private ParameterSyntax RemoveOutParameter(MethodDeclarationSyntax syntax, out MethodDeclarationSyntax convertedSyntax)
{
var list = syntax.ParameterList;
ParameterSyntax outParam = null;
foreach (var parameter in list.Parameters)
{
if (parameter.Modifiers.Count > 0)
{
foreach (var mod in parameter.Modifiers)
{
if (mod.ToString().Equals("out"))
{
outParam = parameter;
}
}
}
}
convertedSyntax = syntax.WithParameterList(list.WithParameters(list.Parameters.Remove(outParam)));
return outParam;
}