本文整理汇总了C#中Microsoft.CodeAnalysis.CSharp.Syntax.CompilationUnitSyntax.WithMembers方法的典型用法代码示例。如果您正苦于以下问题:C# CompilationUnitSyntax.WithMembers方法的具体用法?C# CompilationUnitSyntax.WithMembers怎么用?C# CompilationUnitSyntax.WithMembers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.CodeAnalysis.CSharp.Syntax.CompilationUnitSyntax
的用法示例。
在下文中一共展示了CompilationUnitSyntax.WithMembers方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddMethodTo
internal static CompilationUnitSyntax AddMethodTo(
CompilationUnitSyntax destination,
IMethodSymbol method,
CodeGenerationOptions options,
IList<bool> availableIndices)
{
var declaration = GenerateMethodDeclaration(method, CodeGenerationDestination.CompilationUnit, options);
var members = Insert(destination.Members, declaration, options, availableIndices, after: LastMethod);
return destination.WithMembers(members.ToSyntaxList());
}
示例2: AddNamedTypeTo
public static CompilationUnitSyntax AddNamedTypeTo(
ICodeGenerationService service,
CompilationUnitSyntax destination,
INamedTypeSymbol namedType,
CodeGenerationOptions options,
IList<bool> availableIndices)
{
var declaration = GenerateNamedTypeDeclaration(service, namedType, CodeGenerationDestination.CompilationUnit, options);
var members = Insert(destination.Members, declaration, options, availableIndices);
return destination.WithMembers(members);
}
示例3: AddPropertyTo
internal static CompilationUnitSyntax AddPropertyTo(
CompilationUnitSyntax destination,
IPropertySymbol property,
CodeGenerationOptions options,
IList<bool> availableIndices)
{
var declaration = GeneratePropertyOrIndexer(property, CodeGenerationDestination.CompilationUnit, options);
var members = Insert(destination.Members, declaration, options,
availableIndices, after: LastPropertyOrField, before: FirstMember);
return destination.WithMembers(members);
}
示例4: AddFieldTo
internal static CompilationUnitSyntax AddFieldTo(
CompilationUnitSyntax destination,
IFieldSymbol field,
CodeGenerationOptions options,
IList<bool> availableIndices)
{
var declaration = GenerateFieldDeclaration(field, CodeGenerationDestination.CompilationUnit, options);
// Place the field after the last field or const, or at the start of the type
// declaration.
var members = Insert(destination.Members, declaration, options, availableIndices,
after: m => LastField(m, declaration), before: FirstMember);
return destination.WithMembers(members.ToSyntaxList());
}
示例5: AddEventTo
internal static CompilationUnitSyntax AddEventTo(
CompilationUnitSyntax destination,
IEventSymbol @event,
CodeGenerationOptions options,
IList<bool> availableIndices)
{
var declaration = GenerateEventDeclaration(@event, CodeGenerationDestination.CompilationUnit, options);
// Place the event depending on its shape. Field style events go with fields, property
// style events go with properties. If there
var members = Insert(destination.Members, declaration, options, availableIndices,
after: list => AfterMember(list, declaration), before: list => BeforeMember(list, declaration));
return destination.WithMembers(members.ToSyntaxList());
}
示例6: AddNamespaceTo
public static CompilationUnitSyntax AddNamespaceTo(
ICodeGenerationService service,
CompilationUnitSyntax destination,
INamespaceSymbol @namespace,
CodeGenerationOptions options,
IList<bool> availableIndices)
{
var declaration = GenerateNamespaceDeclaration(service, @namespace, options);
if (!(declaration is NamespaceDeclarationSyntax))
{
throw new ArgumentException(CSharpWorkspaceResources.NamespaceCanNotBeAddedIn);
}
var members = Insert(destination.Members, (NamespaceDeclarationSyntax)declaration, options, availableIndices);
return destination.WithMembers(members);
}