Skip to content

Latest commit

 

History

History
218 lines (182 loc) · 8.26 KB

File metadata and controls

218 lines (182 loc) · 8.26 KB

Microsoft.CodeAnalysis.CSharp.Syntax


ClassDeclarationSyntaxExtensions

Extension methods for Microsoft.CodeAnalysis.CSharp.Syntax.ClassDeclarationSyntax.

public static class ClassDeclarationSyntaxExtensions

Static Methods

AddGeneratedCodeAttribute

ClassDeclarationSyntax AddGeneratedCodeAttribute(this ClassDeclarationSyntax classDeclaration, string toolName, string version)

Summary: Adds a System.CodeDom.Compiler.GeneratedCodeAttribute to the class declaration.

Parameters:
     classDeclaration  -  The class declaration to modify.
     toolName  -  The name of the code generation tool.
     version  -  The version of the code generation tool.

Returns: A new Microsoft.CodeAnalysis.CSharp.Syntax.ClassDeclarationSyntax with the attribute added.

AddSuppressMessageAttribute

ClassDeclarationSyntax AddSuppressMessageAttribute(this ClassDeclarationSyntax classDeclaration, SuppressMessageAttribute suppressMessage)

Summary: Adds a System.Diagnostics.CodeAnalysis.SuppressMessageAttribute to the class declaration.

Parameters:
     classDeclaration  -  The class declaration to modify.
     suppressMessage  -  The suppress message attribute to add.

Returns: A new Microsoft.CodeAnalysis.CSharp.Syntax.ClassDeclarationSyntax with the attribute added.


CompilationUnitSyntaxExtensions

Extension methods for Microsoft.CodeAnalysis.CSharp.Syntax.CompilationUnitSyntax.

public static class CompilationUnitSyntaxExtensions

Static Methods

AddUsingStatements

CompilationUnitSyntax AddUsingStatements(this CompilationUnitSyntax compilationUnit, string[] usingStatements)

Summary: Adds using statements to the compilation unit and sorts them.

Parameters:
     compilationUnit  -  The compilation unit to modify.
     usingStatements  -  The array of using statement strings to add.

Returns: A new Microsoft.CodeAnalysis.CSharp.Syntax.CompilationUnitSyntax with the using statements added and sorted.


EnumDeclarationSyntaxExtensions

Extension methods for Microsoft.CodeAnalysis.CSharp.Syntax.EnumDeclarationSyntax.

public static class EnumDeclarationSyntaxExtensions

Static Methods

AddFlagAttribute

EnumDeclarationSyntax AddFlagAttribute(this EnumDeclarationSyntax enumDeclaration)

Summary: Adds a System.FlagsAttribute to the enum declaration.

Parameters:
     enumDeclaration  -  The enum declaration to modify.

Returns: A new Microsoft.CodeAnalysis.CSharp.Syntax.EnumDeclarationSyntax with the attribute added.

AddSuppressMessageAttribute

EnumDeclarationSyntax AddSuppressMessageAttribute(this EnumDeclarationSyntax enumDeclaration, SuppressMessageAttribute suppressMessage)

Summary: Adds a System.Diagnostics.CodeAnalysis.SuppressMessageAttribute to the enum declaration.

Parameters:
     enumDeclaration  -  The enum declaration to modify.
     suppressMessage  -  The suppress message attribute to add.

Returns: A new Microsoft.CodeAnalysis.CSharp.Syntax.EnumDeclarationSyntax with the attribute added.

HasAttributeOfAttributeType

bool HasAttributeOfAttributeType(this EnumDeclarationSyntax enumDeclaration, Type attributeType)

Summary: Determines whether the enum declaration has an attribute of the specified type.

Parameters:
     enumDeclaration  -  The enum declaration to check.
     attributeType  -  The type of attribute to search for.

Returns: true if the enum has an attribute of the specified type; otherwise, false.


InterfaceDeclarationSyntaxExtensions

Extension methods for Microsoft.CodeAnalysis.CSharp.Syntax.InterfaceDeclarationSyntax.

public static class InterfaceDeclarationSyntaxExtensions

Static Methods

AddGeneratedCodeAttribute

InterfaceDeclarationSyntax AddGeneratedCodeAttribute(this InterfaceDeclarationSyntax interfaceDeclaration, string toolName, string version)

Summary: Adds a System.CodeDom.Compiler.GeneratedCodeAttribute to the interface declaration.

Parameters:
     interfaceDeclaration  -  The interface declaration to modify.
     toolName  -  The name of the code generation tool.
     version  -  The version of the code generation tool.

Returns: A new Microsoft.CodeAnalysis.CSharp.Syntax.InterfaceDeclarationSyntax with the attribute added.


MethodDeclarationSyntaxExtensions

Extension methods for Microsoft.CodeAnalysis.CSharp.Syntax.MethodDeclarationSyntax.

public static class MethodDeclarationSyntaxExtensions

Static Methods

AddSuppressMessageAttribute

MethodDeclarationSyntax AddSuppressMessageAttribute(this MethodDeclarationSyntax methodDeclaration, SuppressMessageAttribute suppressMessage)

Summary: Adds a System.Diagnostics.CodeAnalysis.SuppressMessageAttribute to the method declaration.

Parameters:
     methodDeclaration  -  The method declaration to modify.
     suppressMessage  -  The suppress message attribute to add.

Returns: A new Microsoft.CodeAnalysis.CSharp.Syntax.MethodDeclarationSyntax with the attribute added.


SyntaxNodeExtensions

Extension methods for Microsoft.CodeAnalysis.SyntaxNode.

public static class SyntaxNodeExtensions

Static Methods

GetUsedUsingStatements

string[] GetUsedUsingStatements(this SyntaxNode syntaxNode)

Summary: Gets all using directive statements from the syntax node.

Parameters:
     syntaxNode  -  The syntax node to search.

Returns: An array of using directive strings.

GetUsedUsingStatementsWithoutAlias

string[] GetUsedUsingStatementsWithoutAlias(this SyntaxNode syntaxNode)

Summary: Gets all using directive statements from the syntax node, excluding those with aliases.

Parameters:
     syntaxNode  -  The syntax node to search.

Returns: An array of using directive strings without aliases.

Select

IEnumerable<T> Select(this SyntaxNode syntaxNode)

Summary: Selects all descendant nodes of type T from the syntax node.

Parameters:
     syntaxNode  -  The syntax node to search.

Returns: An enumerable collection of syntax nodes of type T.

SelectToArray

T[] SelectToArray(this SyntaxNode syntaxNode)

Summary: Selects all descendant nodes of type T from the syntax node and returns them as an array.

Parameters:
     syntaxNode  -  The syntax node to search.

Returns: An array of syntax nodes of type T.


UsingDirectiveSyntaxExtensions

Extension methods for Microsoft.CodeAnalysis.CSharp.Syntax.UsingDirectiveSyntax.

public static class UsingDirectiveSyntaxExtensions

Generated by MarkdownCodeDoc version 1.2