Skip to content

Latest commit

 

History

History
1226 lines (1099 loc) · 47.1 KB

File metadata and controls

1226 lines (1099 loc) · 47.1 KB

Atc.CodeAnalysis.CSharp.SyntaxFactories


SyntaxAccessorDeclarationFactory

Factory for creating Microsoft.CodeAnalysis.CSharp.Syntax.AccessorDeclarationSyntax nodes.

public static class SyntaxAccessorDeclarationFactory

Static Methods

Get

AccessorDeclarationSyntax Get(bool withSemicolon = True)

Summary: Creates a get accessor declaration.

Parameters:
     withSemicolon  -  If true, includes a semicolon token; otherwise, uses a missing token.

Returns: An Microsoft.CodeAnalysis.CSharp.Syntax.AccessorDeclarationSyntax representing a get accessor.

Set

AccessorDeclarationSyntax Set(bool withSemicolon = True)

Summary: Creates a set accessor declaration.

Parameters:
     withSemicolon  -  If true, includes a semicolon token; otherwise, uses a missing token.

Returns: An Microsoft.CodeAnalysis.CSharp.Syntax.AccessorDeclarationSyntax representing a set accessor.


SyntaxArgumentFactory

Factory for creating Microsoft.CodeAnalysis.CSharp.Syntax.ArgumentSyntax nodes.

public static class SyntaxArgumentFactory

Static Methods

Create

ArgumentSyntax Create(string argumentName)

Summary: Creates an argument from an identifier name.

Parameters:
     argumentName  -  The name of the argument identifier.

Returns: An Microsoft.CodeAnalysis.CSharp.Syntax.ArgumentSyntax node.


SyntaxArgumentListFactory

Factory for creating Microsoft.CodeAnalysis.CSharp.Syntax.ArgumentListSyntax nodes.

public static class SyntaxArgumentListFactory

Static Methods

CreateWithOneArgumentItem

ArgumentListSyntax CreateWithOneArgumentItem(ArgumentSyntax argument)

Summary: Creates an argument list with a single argument.

Parameters:
     argument  -  The argument to include.

Returns: An Microsoft.CodeAnalysis.CSharp.Syntax.ArgumentListSyntax containing one argument.

CreateWithOneExpressionItem

ArgumentListSyntax CreateWithOneExpressionItem(ExpressionSyntax argumentExpression1)

Summary: Creates an argument list with a single argument from an expression.

Parameters:
     argumentExpression1  -  The expression to use as the argument.

Returns: An Microsoft.CodeAnalysis.CSharp.Syntax.ArgumentListSyntax containing one argument.

CreateWithOneItem

ArgumentListSyntax CreateWithOneItem(string argumentName)

Summary: Creates an argument list with a single argument from an identifier name.

Parameters:
     argumentName  -  The name of the argument identifier.

Returns: An Microsoft.CodeAnalysis.CSharp.Syntax.ArgumentListSyntax containing one argument.

CreateWithThreeArgumentItems

ArgumentListSyntax CreateWithThreeArgumentItems(ArgumentSyntax argument1, ArgumentSyntax argument2, ArgumentSyntax argument3)

Summary: Creates an argument list with three arguments.

Parameters:
     argument1  -  The first argument to include.
     argument2  -  The second argument to include.
     argument3  -  The third argument to include.

Returns: An Microsoft.CodeAnalysis.CSharp.Syntax.ArgumentListSyntax containing three arguments.

CreateWithThreeExpressionItems

ArgumentListSyntax CreateWithThreeExpressionItems(ExpressionSyntax argumentExpression1, ExpressionSyntax argumentExpression2, ExpressionSyntax argumentExpression3)

Summary: Creates an argument list with three arguments from expressions.

Parameters:
     argumentExpression1  -  The expression to use as the first argument.
     argumentExpression2  -  The expression to use as the second argument.
     argumentExpression3  -  The expression to use as the third argument.

Returns: An Microsoft.CodeAnalysis.CSharp.Syntax.ArgumentListSyntax containing three arguments.

CreateWithTwoArgumentItems

ArgumentListSyntax CreateWithTwoArgumentItems(ArgumentSyntax argument1, ArgumentSyntax argument2)

Summary: Creates an argument list with two arguments.

Parameters:
     argument1  -  The first argument to include.
     argument2  -  The second argument to include.

Returns: An Microsoft.CodeAnalysis.CSharp.Syntax.ArgumentListSyntax containing two arguments.

CreateWithTwoExpressionItems

ArgumentListSyntax CreateWithTwoExpressionItems(ExpressionSyntax argumentExpression1, ExpressionSyntax argumentExpression2)

Summary: Creates an argument list with two arguments from expressions.

Parameters:
     argumentExpression1  -  The expression to use as the first argument.
     argumentExpression2  -  The expression to use as the second argument.

Returns: An Microsoft.CodeAnalysis.CSharp.Syntax.ArgumentListSyntax containing two arguments.

CreateWithTwoItems

ArgumentListSyntax CreateWithTwoItems(string argumentName1, string argumentName2)

Summary: Creates an argument list with two arguments from identifier names.

Parameters:
     argumentName1  -  The name of the first argument identifier.
     argumentName2  -  The name of the second argument identifier.

Returns: An Microsoft.CodeAnalysis.CSharp.Syntax.ArgumentListSyntax containing two arguments.


SyntaxAssignmentExpressionFactory

Factory for creating Microsoft.CodeAnalysis.CSharp.Syntax.AssignmentExpressionSyntax nodes.

public static class SyntaxAssignmentExpressionFactory

Static Methods

CreateSimple

AssignmentExpressionSyntax CreateSimple(string toIdentifierName, string fromIdentifierName)

Summary: Creates a simple assignment expression (e.g., toIdentifierName = fromIdentifierName).

Parameters:
     toIdentifierName  -  The identifier name on the left side of the assignment.
     fromIdentifierName  -  The identifier name on the right side of the assignment.

Returns: An Microsoft.CodeAnalysis.CSharp.Syntax.AssignmentExpressionSyntax node representing the simple assignment.


SyntaxAttributeArgumentFactory

Factory for creating Microsoft.CodeAnalysis.CSharp.Syntax.AttributeArgumentSyntax nodes.

public static class SyntaxAttributeArgumentFactory

Static Methods

Create

AttributeArgumentSyntax Create(string attributeValue)

Summary: Creates an attribute argument from a string value.

Parameters:
     attributeValue  -  The string value for the attribute argument.

Returns: An Microsoft.CodeAnalysis.CSharp.Syntax.AttributeArgumentSyntax node.

Create

AttributeArgumentSyntax Create(int attributeValue)

Summary: Creates an attribute argument from a string value.

Parameters:
     attributeValue  -  The string value for the attribute argument.

Returns: An Microsoft.CodeAnalysis.CSharp.Syntax.AttributeArgumentSyntax node.

Create

AttributeArgumentSyntax Create(object attributeValue)

Summary: Creates an attribute argument from a string value.

Parameters:
     attributeValue  -  The string value for the attribute argument.

Returns: An Microsoft.CodeAnalysis.CSharp.Syntax.AttributeArgumentSyntax node.

CreateWithNameEquals

AttributeArgumentSyntax CreateWithNameEquals(string attributeName, string attributeValue)

Summary: Creates an attribute argument with a name-equals syntax from a string value.

Parameters:
     attributeName  -  The name of the attribute property.
     attributeValue  -  The string value for the attribute argument.

Returns: An Microsoft.CodeAnalysis.CSharp.Syntax.AttributeArgumentSyntax node with a name-equals clause.

CreateWithNameEquals

AttributeArgumentSyntax CreateWithNameEquals(string attributeName, int attributeValue)

Summary: Creates an attribute argument with a name-equals syntax from a string value.

Parameters:
     attributeName  -  The name of the attribute property.
     attributeValue  -  The string value for the attribute argument.

Returns: An Microsoft.CodeAnalysis.CSharp.Syntax.AttributeArgumentSyntax node with a name-equals clause.


SyntaxAttributeArgumentListFactory

Factory for creating Microsoft.CodeAnalysis.CSharp.Syntax.AttributeArgumentListSyntax nodes.

public static class SyntaxAttributeArgumentListFactory

Static Methods

CreateWithOneItemWithNameEquals

AttributeArgumentListSyntax CreateWithOneItemWithNameEquals(string attributeName, string attributeValue)

Summary: Creates an attribute argument list with a single named argument from a string value.

Parameters:
     attributeName  -  The name of the attribute property.
     attributeValue  -  The string value for the attribute argument.

Returns: An Microsoft.CodeAnalysis.CSharp.Syntax.AttributeArgumentListSyntax containing one named argument.

CreateWithOneItemWithNameEquals

AttributeArgumentListSyntax CreateWithOneItemWithNameEquals(string attributeName, int attributeValue)

Summary: Creates an attribute argument list with a single named argument from a string value.

Parameters:
     attributeName  -  The name of the attribute property.
     attributeValue  -  The string value for the attribute argument.

Returns: An Microsoft.CodeAnalysis.CSharp.Syntax.AttributeArgumentListSyntax containing one named argument.


SyntaxAttributeFactory

Syntax Attribute Factory.

Remarks: List of ValidationAttribute's: https://referencesource.microsoft.com/#System.ComponentModel.DataAnnotations/DataAnnotations/ValidationAttribute.cs.

public static class SyntaxAttributeFactory

Static Methods

Create

AttributeSyntax Create(string attributeName)

Summary: Creates an attribute from a name.

Parameters:
     attributeName  -  The name of the attribute (with or without "Attribute" suffix).

Returns: An Microsoft.CodeAnalysis.CSharp.Syntax.AttributeSyntax node.

CreateFromValidationAttribute

AttributeSyntax CreateFromValidationAttribute(ValidationAttribute validationAttribute)

Summary: Creates an attribute syntax from a System.ComponentModel.DataAnnotations.ValidationAttribute instance.

Parameters:
     validationAttribute  -  The validation attribute to convert.

Returns: An Microsoft.CodeAnalysis.CSharp.Syntax.AttributeSyntax node representing the validation attribute.

CreateWithOneItemWithOneArgument

AttributeSyntax CreateWithOneItemWithOneArgument(string attributeName, string argumentValue)

Summary: Creates an attribute with a single string argument.

Parameters:
     attributeName  -  The name of the attribute (with or without "Attribute" suffix).
     argumentValue  -  The string value for the argument.

Returns: An Microsoft.CodeAnalysis.CSharp.Syntax.AttributeSyntax node with one argument.

CreateWithOneItemWithOneArgument

AttributeSyntax CreateWithOneItemWithOneArgument(string attributeName, int argumentValue)

Summary: Creates an attribute with a single string argument.

Parameters:
     attributeName  -  The name of the attribute (with or without "Attribute" suffix).
     argumentValue  -  The string value for the argument.

Returns: An Microsoft.CodeAnalysis.CSharp.Syntax.AttributeSyntax node with one argument.

CreateWithOneItemWithTwoArgument

AttributeSyntax CreateWithOneItemWithTwoArgument(string attributeName, object argumentValue1, object argumentValue2)

Summary: Creates an attribute with two arguments.

Parameters:
     attributeName  -  The name of the attribute (with or without "Attribute" suffix).
     argumentValue1  -  The first argument value.
     argumentValue2  -  The second argument value.

Returns: An Microsoft.CodeAnalysis.CSharp.Syntax.AttributeSyntax node with two arguments.

RemoveSuffix

string RemoveSuffix(string attributeName)

Summary: Removes the "Attribute" suffix from an attribute name if present.

Parameters:
     attributeName  -  The attribute name to process.

Returns: The attribute name without the "Attribute" suffix.


SyntaxAttributeListFactory

Factory for creating Microsoft.CodeAnalysis.CSharp.Syntax.AttributeListSyntax nodes.

public static class SyntaxAttributeListFactory

Static Methods

Create

AttributeListSyntax Create(string attributeName)

Summary: Creates an attribute list with a single attribute.

Parameters:
     attributeName  -  The name of the attribute.

Returns: An Microsoft.CodeAnalysis.CSharp.Syntax.AttributeListSyntax containing one attribute.

Create

AttributeListSyntax Create(string attributeName, AttributeArgumentListSyntax attributeArgumentList)

Summary: Creates an attribute list with a single attribute.

Parameters:
     attributeName  -  The name of the attribute.

Returns: An Microsoft.CodeAnalysis.CSharp.Syntax.AttributeListSyntax containing one attribute.

CreateWithOneItemWithOneArgument

AttributeListSyntax CreateWithOneItemWithOneArgument(string attributeName, string argumentValue)

Summary: Creates an attribute list with a single attribute and one string argument.

Parameters:
     attributeName  -  The name of the attribute.
     argumentValue  -  The string value for the argument.

Returns: An Microsoft.CodeAnalysis.CSharp.Syntax.AttributeListSyntax containing one attribute with one argument.

CreateWithOneItemWithOneArgumentWithNameEquals

AttributeListSyntax CreateWithOneItemWithOneArgumentWithNameEquals(string attributeName, string argumentName, string argumentValue)

Summary: Creates an attribute list with a single attribute and one named argument.

Parameters:
     attributeName  -  The name of the attribute.
     argumentName  -  The name of the argument property.
     argumentValue  -  The string value for the argument.

Returns: An Microsoft.CodeAnalysis.CSharp.Syntax.AttributeListSyntax containing one attribute with a named argument.


SyntaxBaseListFactory

Factory for creating Microsoft.CodeAnalysis.CSharp.Syntax.BaseListSyntax nodes.

public static class SyntaxBaseListFactory

Static Methods

CreateOneSimpleBaseType

BaseListSyntax CreateOneSimpleBaseType(string typeName)

Summary: Creates a base list with a single base type.

Parameters:
     typeName  -  The name of the base type.

Returns: A Microsoft.CodeAnalysis.CSharp.Syntax.BaseListSyntax containing one base type.

CreateTwoSimpleBaseTypes

BaseListSyntax CreateTwoSimpleBaseTypes(string typeName1, string typeName2)

Summary: Creates a base list with two base types.

Parameters:
     typeName1  -  The name of the first base type.
     typeName2  -  The name of the second base type.

Returns: A Microsoft.CodeAnalysis.CSharp.Syntax.BaseListSyntax containing two base types.


SyntaxClassDeclarationFactory

Factory for creating Microsoft.CodeAnalysis.CSharp.Syntax.ClassDeclarationSyntax nodes.

public static class SyntaxClassDeclarationFactory

Static Methods

Create

ClassDeclarationSyntax Create(string classTypeName)

Summary: Creates a public class declaration.

Parameters:
     classTypeName  -  The name of the class.

Returns: A Microsoft.CodeAnalysis.CSharp.Syntax.ClassDeclarationSyntax with public modifier.

CreateAsInternalStatic

ClassDeclarationSyntax CreateAsInternalStatic(string classTypeName)

Summary: Creates an internal static class declaration.

Parameters:
     classTypeName  -  The name of the class.

Returns: A Microsoft.CodeAnalysis.CSharp.Syntax.ClassDeclarationSyntax with internal and static modifiers.

CreateAsPublicPartial

ClassDeclarationSyntax CreateAsPublicPartial(string classTypeName)

Summary: Creates a public partial class declaration.

Parameters:
     classTypeName  -  The name of the class.

Returns: A Microsoft.CodeAnalysis.CSharp.Syntax.ClassDeclarationSyntax with public and partial modifiers.

CreateAsPublicStatic

ClassDeclarationSyntax CreateAsPublicStatic(string classTypeName)

Summary: Creates a public static class declaration.

Parameters:
     classTypeName  -  The name of the class.

Returns: A Microsoft.CodeAnalysis.CSharp.Syntax.ClassDeclarationSyntax with public and static modifiers.

CreateWithInheritClassAndInterface

ClassDeclarationSyntax CreateWithInheritClassAndInterface(string classTypeName, string inheritClassTypeName, string interfaceTypeName)

Summary: Creates a public class declaration that inherits from a base class and implements an interface.

Parameters:
     classTypeName  -  The name of the class.
     inheritClassTypeName  -  The name of the base class to inherit from.
     interfaceTypeName  -  The name of the interface to implement.

Returns: A Microsoft.CodeAnalysis.CSharp.Syntax.ClassDeclarationSyntax with inheritance and interface implementation.

CreateWithInheritClassType

ClassDeclarationSyntax CreateWithInheritClassType(string classTypeName, string inheritClassTypeName)

Summary: Creates a public class declaration that inherits from a base class.

Parameters:
     classTypeName  -  The name of the class.
     inheritClassTypeName  -  The name of the base class to inherit from.

Returns: A Microsoft.CodeAnalysis.CSharp.Syntax.ClassDeclarationSyntax with inheritance.

CreateWithInheritClassTypeAndSuppressMessageAttributeByCodeAnalysisCheckId

ClassDeclarationSyntax CreateWithInheritClassTypeAndSuppressMessageAttributeByCodeAnalysisCheckId(string classTypeName, string inheritClassTypeName, int checkId, string justification = )

Summary: Creates a public class declaration with inheritance and a Code Analysis suppress message attribute.

Parameters:
     classTypeName  -  The name of the class.
     inheritClassTypeName  -  The name of the base class to inherit from.
     checkId  -  The Code Analysis check ID to suppress.
     justification  -  The justification for suppressing the check.

Returns: A Microsoft.CodeAnalysis.CSharp.Syntax.ClassDeclarationSyntax with inheritance and the suppress message attribute.

CreateWithInheritClassTypeAndSuppressMessageAttributeByStyleCopCheckId

ClassDeclarationSyntax CreateWithInheritClassTypeAndSuppressMessageAttributeByStyleCopCheckId(string classTypeName, string inheritClassTypeName, int checkId, string justification = )

Summary: Creates a public class declaration with inheritance and a StyleCop suppress message attribute.

Parameters:
     classTypeName  -  The name of the class.
     inheritClassTypeName  -  The name of the base class to inherit from.
     checkId  -  The StyleCop check ID to suppress.
     justification  -  The justification for suppressing the check.

Returns: A Microsoft.CodeAnalysis.CSharp.Syntax.ClassDeclarationSyntax with inheritance and the suppress message attribute.

CreateWithInterface

ClassDeclarationSyntax CreateWithInterface(string classTypeName, string interfaceTypeName)

Summary: Creates a public class declaration that implements an interface.

Parameters:
     classTypeName  -  The name of the class.
     interfaceTypeName  -  The name of the interface to implement.

Returns: A Microsoft.CodeAnalysis.CSharp.Syntax.ClassDeclarationSyntax with interface implementation.

CreateWithSuppressMessageAttribute

ClassDeclarationSyntax CreateWithSuppressMessageAttribute(string classTypeName, SuppressMessageAttribute suppressMessage)

Summary: Creates a public class declaration with a suppress message attribute.

Parameters:
     classTypeName  -  The name of the class.
     suppressMessage  -  The suppress message attribute to add.

Returns: A Microsoft.CodeAnalysis.CSharp.Syntax.ClassDeclarationSyntax with the suppress message attribute.

CreateWithSuppressMessageAttributeByCodeAnalysisCheckId

ClassDeclarationSyntax CreateWithSuppressMessageAttributeByCodeAnalysisCheckId(string classTypeName, int checkId, string justification = )

Summary: Creates a public class declaration with a Code Analysis suppress message attribute.

Parameters:
     classTypeName  -  The name of the class.
     checkId  -  The Code Analysis check ID to suppress.
     justification  -  The justification for suppressing the check.

Returns: A Microsoft.CodeAnalysis.CSharp.Syntax.ClassDeclarationSyntax with the suppress message attribute.

CreateWithSuppressMessageAttributeByStyleCopCheckId

ClassDeclarationSyntax CreateWithSuppressMessageAttributeByStyleCopCheckId(string classTypeName, int checkId, string justification = )

Summary: Creates a public class declaration with a StyleCop suppress message attribute.

Parameters:
     classTypeName  -  The name of the class.
     checkId  -  The StyleCop check ID to suppress.
     justification  -  The justification for suppressing the check.

Returns: A Microsoft.CodeAnalysis.CSharp.Syntax.ClassDeclarationSyntax with the suppress message attribute.


SyntaxIfStatementFactory

Factory for creating Microsoft.CodeAnalysis.CSharp.Syntax.IfStatementSyntax nodes.

public static class SyntaxIfStatementFactory

Static Methods

CreateParameterArgumentNullCheck

StatementSyntax CreateParameterArgumentNullCheck(string parameterName, bool includeSystem = True)

Summary: Creates an if statement that checks if a parameter is null and throws System.ArgumentNullException.

Parameters:
     parameterName  -  The name of the parameter to check for null.
     includeSystem  -  If true, includes the System namespace prefix for ArgumentNullException.

Returns: A Microsoft.CodeAnalysis.CSharp.Syntax.StatementSyntax representing the null check.


SyntaxInterfaceDeclarationFactory

Factory for creating Microsoft.CodeAnalysis.CSharp.Syntax.InterfaceDeclarationSyntax nodes.

public static class SyntaxInterfaceDeclarationFactory

Static Methods

Create

InterfaceDeclarationSyntax Create(string interfaceTypeName)

Summary: Creates a public interface declaration.

Parameters:
     interfaceTypeName  -  The name of the interface.

Returns: An Microsoft.CodeAnalysis.CSharp.Syntax.InterfaceDeclarationSyntax with public modifier.


SyntaxInterpolatedFactory

Factory for creating Microsoft.CodeAnalysis.CSharp.Syntax.InterpolatedStringContentSyntax nodes for interpolated strings.

public static class SyntaxInterpolatedFactory

Static Methods

CreateNameOf

InterpolatedStringContentSyntax CreateNameOf(string argumentName)

Summary: Creates an interpolated content node containing a nameof expression.

Parameters:
     argumentName  -  The name of the argument to use in the nameof expression.

Returns: An Microsoft.CodeAnalysis.CSharp.Syntax.InterpolatedStringContentSyntax representing nameof(argumentName).

StringText

InterpolatedStringContentSyntax StringText(string value)

Summary: Creates an interpolated string text content from a value.

Parameters:
     value  -  The text value to include in the interpolated string.

Returns: An Microsoft.CodeAnalysis.CSharp.Syntax.InterpolatedStringContentSyntax representing the text.

StringTextColon

InterpolatedStringContentSyntax StringTextColon()

Summary: Creates interpolated string text for a colon and space (": ").

Returns: An Microsoft.CodeAnalysis.CSharp.Syntax.InterpolatedStringContentSyntax representing ": ".

StringTextColonAndParenthesesStart

InterpolatedStringContentSyntax StringTextColonAndParenthesesStart()

Summary: Creates interpolated string text for ": (".

Returns: An Microsoft.CodeAnalysis.CSharp.Syntax.InterpolatedStringContentSyntax representing ": (".

StringTextComma

InterpolatedStringContentSyntax StringTextComma()

Summary: Creates interpolated string text for a comma and space (", ").

Returns: An Microsoft.CodeAnalysis.CSharp.Syntax.InterpolatedStringContentSyntax representing ", ".

StringTextDotCountColon

InterpolatedStringContentSyntax StringTextDotCountColon()

Summary: Creates interpolated string text for ".Count: ".

Returns: An Microsoft.CodeAnalysis.CSharp.Syntax.InterpolatedStringContentSyntax representing ".Count: ".

StringTextParenthesesEnd

InterpolatedStringContentSyntax StringTextParenthesesEnd()

Summary: Creates interpolated string text for ")".

Returns: An Microsoft.CodeAnalysis.CSharp.Syntax.InterpolatedStringContentSyntax representing ")".


SyntaxLiteralExpressionFactory

Factory for creating Microsoft.CodeAnalysis.CSharp.Syntax.LiteralExpressionSyntax nodes.

public static class SyntaxLiteralExpressionFactory

Static Methods

Create

LiteralExpressionSyntax Create(string value, SyntaxKind syntaxKind = StringLiteralExpression)

Summary: Creates a literal expression from a string value with the specified syntax kind.

Parameters:
     value  -  The value for the literal expression.
     syntaxKind  -  The syntax kind for the literal (string or numeric).

Returns: A Microsoft.CodeAnalysis.CSharp.Syntax.LiteralExpressionSyntax node.

Create

LiteralExpressionSyntax Create(int value)

Summary: Creates a literal expression from a string value with the specified syntax kind.

Parameters:
     value  -  The value for the literal expression.
     syntaxKind  -  The syntax kind for the literal (string or numeric).

Returns: A Microsoft.CodeAnalysis.CSharp.Syntax.LiteralExpressionSyntax node.


SyntaxMemberAccessExpressionFactory

Factory for creating Microsoft.CodeAnalysis.CSharp.Syntax.MemberAccessExpressionSyntax nodes.

public static class SyntaxMemberAccessExpressionFactory

Static Methods

Create

MemberAccessExpressionSyntax Create(string memberTypeName, string memberName)

Summary: Creates a simple member access expression (e.g., memberName.memberTypeName).

Parameters:
     memberTypeName  -  The name of the member being accessed.
     memberName  -  The name of the object containing the member.

Returns: A Microsoft.CodeAnalysis.CSharp.Syntax.MemberAccessExpressionSyntax node.


SyntaxNameEqualsFactory

Factory for creating Microsoft.CodeAnalysis.CSharp.Syntax.NameEqualsSyntax nodes.

public static class SyntaxNameEqualsFactory

Static Methods

Create

NameEqualsSyntax Create(string value)

Summary: Creates a name-equals syntax node (used in attribute named arguments and object initializers).

Parameters:
     value  -  The identifier name for the name-equals clause.

Returns: A Microsoft.CodeAnalysis.CSharp.Syntax.NameEqualsSyntax node.


SyntaxObjectCreationExpressionFactory

Factory for creating Microsoft.CodeAnalysis.CSharp.Syntax.ObjectCreationExpressionSyntax nodes.

public static class SyntaxObjectCreationExpressionFactory

Static Methods

Create

ObjectCreationExpressionSyntax Create(string identifierName)

Summary: Creates an object creation expression for a type.

Parameters:
     identifierName  -  The name of the type to instantiate.

Returns: An Microsoft.CodeAnalysis.CSharp.Syntax.ObjectCreationExpressionSyntax node.

Create

ObjectCreationExpressionSyntax Create(string namespaceName, string identifierName)

Summary: Creates an object creation expression for a type.

Parameters:
     identifierName  -  The name of the type to instantiate.

Returns: An Microsoft.CodeAnalysis.CSharp.Syntax.ObjectCreationExpressionSyntax node.


SyntaxParameterFactory

Factory for creating Microsoft.CodeAnalysis.CSharp.Syntax.ParameterSyntax nodes.

public static class SyntaxParameterFactory

Static Methods

Create

ParameterSyntax Create(string parameterTypeName, string parameterName, string genericListTypeName = null)

Summary: Creates a parameter with an optional generic list type.

Parameters:
     parameterTypeName  -  The type name of the parameter.
     parameterName  -  The name of the parameter.
     genericListTypeName  -  The generic list type name (e.g., "List", "IEnumerable").

Returns: A Microsoft.CodeAnalysis.CSharp.Syntax.ParameterSyntax node.

CreateWithAttribute

ParameterSyntax CreateWithAttribute(string attributeTypeName, string parameterTypeName, string parameterName)

Summary: Creates a parameter with an attribute.

Parameters:
     attributeTypeName  -  The type name of the attribute to apply.
     parameterTypeName  -  The type name of the parameter.
     parameterName  -  The name of the parameter.

Returns: A Microsoft.CodeAnalysis.CSharp.Syntax.ParameterSyntax node with an attribute.


SyntaxParameterListFactory

Factory for creating Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax nodes.

public static class SyntaxParameterListFactory

Static Methods

CreateWithOneItem

ParameterListSyntax CreateWithOneItem(string parameterTypeName, string parameterName, string genericListTypeName = null)

Summary: Creates a parameter list with a single parameter.

Parameters:
     parameterTypeName  -  The type name of the parameter.
     parameterName  -  The name of the parameter.
     genericListTypeName  -  The generic list type name (e.g., "List", "IEnumerable").

Returns: A Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax containing one parameter.

CreateWithOneParameterItem

ParameterListSyntax CreateWithOneParameterItem(ParameterSyntax parameter)

Summary: Creates a parameter list with one parameter.

Parameters:
     parameter  -  The parameter to include.

Returns: A Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax containing one parameter.

CreateWithThreeParameterItems

ParameterListSyntax CreateWithThreeParameterItems(ParameterSyntax parameter1, ParameterSyntax parameter2, ParameterSyntax parameter3)

Summary: Creates a parameter list with three parameters.

Parameters:
     parameter1  -  The first parameter to include.
     parameter2  -  The second parameter to include.
     parameter3  -  The third parameter to include.

Returns: A Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax containing three parameters.

CreateWithTwoParameterItems

ParameterListSyntax CreateWithTwoParameterItems(ParameterSyntax parameter1, ParameterSyntax parameter2)

Summary: Creates a parameter list with two parameters.

Parameters:
     parameter1  -  The first parameter to include.
     parameter2  -  The second parameter to include.

Returns: A Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax containing two parameters.


SyntaxSimpleBaseTypeFactory

Factory for creating Microsoft.CodeAnalysis.CSharp.Syntax.SimpleBaseTypeSyntax nodes.

public static class SyntaxSimpleBaseTypeFactory

Static Methods

Create

SimpleBaseTypeSyntax Create(string typeName)

Summary: Creates a simple base type from a type name.

Parameters:
     typeName  -  The name of the base type.

Returns: A Microsoft.CodeAnalysis.CSharp.Syntax.SimpleBaseTypeSyntax node.


SyntaxThrowStatementFactory

Factory for creating Microsoft.CodeAnalysis.CSharp.Syntax.ThrowStatementSyntax nodes.

public static class SyntaxThrowStatementFactory

Static Methods

CreateArgumentNullException

ThrowStatementSyntax CreateArgumentNullException(string parameterName, bool includeSystem = True)

Summary: Creates a throw statement for System.ArgumentNullException with a parameter name.

Parameters:
     parameterName  -  The name of the null parameter.
     includeSystem  -  If true, includes the System namespace prefix.

Returns: A Microsoft.CodeAnalysis.CSharp.Syntax.ThrowStatementSyntax node throwing ArgumentNullException.

CreateNotImplementedException

ThrowStatementSyntax CreateNotImplementedException(bool includeSystem = True)

Summary: Creates a throw statement for System.NotImplementedException.

Parameters:
     includeSystem  -  If true, includes the System namespace prefix.

Returns: A Microsoft.CodeAnalysis.CSharp.Syntax.ThrowStatementSyntax node throwing NotImplementedException.


SyntaxTokenFactory

SyntaxTokenFactory - for base methods.

public static class SyntaxTokenFactory

Static Methods

AbstractKeyword

SyntaxToken AbstractKeyword(bool withTrailingSpace = True)

AsyncKeyword

SyntaxToken AsyncKeyword(bool withTrailingSpace = True)

ByteKeyword

SyntaxToken ByteKeyword(bool withTrailingSpace = True)

CarriageReturnLineFeed

SyntaxToken CarriageReturnLineFeed()

Colon

SyntaxToken Colon(bool withTrailingSpace = False)

Comma

SyntaxToken Comma(bool withTrailingSpace = True)

DefaultKeyword

SyntaxToken DefaultKeyword(bool withTrailingSpace = True)

DoubleKeyword

SyntaxToken DoubleKeyword(bool withTrailingSpace = True)

Equals

SyntaxToken Equals(bool withTrailingSpace = True)

EqualsGreaterThan

SyntaxToken EqualsGreaterThan(bool withTrailingSpace = True)

ImplicitKeyword

SyntaxToken ImplicitKeyword(bool withTrailingSpace = True)

IntKeyword

SyntaxToken IntKeyword(bool withTrailingSpace = True)

InternalKeyword

SyntaxToken InternalKeyword(bool withTrailingSpace = True)

LineFeed

SyntaxToken LineFeed()

NewKeyword

SyntaxToken NewKeyword(bool withTrailingSpace = True)

ObjectKeyword

SyntaxToken ObjectKeyword(bool withTrailingSpace = True)

OperatorKeyword

SyntaxToken OperatorKeyword(bool withTrailingSpace = True)

OverrideKeyword

SyntaxToken OverrideKeyword(bool withTrailingSpace = True)

PartialKeyword

SyntaxToken PartialKeyword(bool withTrailingSpace = True)

PrivateKeyword

SyntaxToken PrivateKeyword(bool withTrailingSpace = True)

ProtectedKeyword

SyntaxToken ProtectedKeyword(bool withTrailingSpace = True)

PublicKeyword

SyntaxToken PublicKeyword(bool withTrailingSpace = True)

ReadOnlyKeyword

SyntaxToken ReadOnlyKeyword(bool withTrailingSpace = True)

Semicolon

SyntaxToken Semicolon(bool withTrailingSpace = False)

StaticKeyword

SyntaxToken StaticKeyword(bool withTrailingSpace = True)

StringKeyword

SyntaxToken StringKeyword(bool withTrailingSpace = True)

Token

SyntaxToken Token(SyntaxKind syntaxKind)

Summary: Creates a syntax token of the specified kind.

Parameters:
     syntaxKind  -  The kind of token to create.

Returns: A Microsoft.CodeAnalysis.SyntaxToken.

TokenWithTrailing

SyntaxToken TokenWithTrailing(SyntaxKind syntaxKind, SyntaxTrivia syntaxTrivia)

Summary: Creates a syntax token with trailing trivia.

Parameters:
     syntaxKind  -  The kind of token to create.
     syntaxTrivia  -  The trailing trivia to add.

Returns: A Microsoft.CodeAnalysis.SyntaxToken with the specified trailing trivia.

TokenWithTrailingSpace

SyntaxToken TokenWithTrailingSpace(SyntaxKind syntaxKind)

Summary: Creates a syntax token with a trailing space.

Parameters:
     syntaxKind  -  The kind of token to create.

Returns: A Microsoft.CodeAnalysis.SyntaxToken with trailing space trivia.

VoidKeyword

SyntaxToken VoidKeyword(bool withTrailingSpace = True)

SyntaxTokenListFactory

Factory for creating Microsoft.CodeAnalysis.SyntaxTokenList modifier lists.

public static class SyntaxTokenListFactory

Static Methods

InternalStaticKeyword

SyntaxTokenList InternalStaticKeyword(bool withLeadingLineFeed = False, bool withTrailingSpace = True)

PrivateAsyncKeyword

SyntaxTokenList PrivateAsyncKeyword(bool withLeadingLineFeed = False, bool withTrailingSpace = True)

PrivateReadonlyKeyword

SyntaxTokenList PrivateReadonlyKeyword(bool withTrailingSpace = True)

ProtectedReadOnlyKeyword

SyntaxTokenList ProtectedReadOnlyKeyword(bool withLeadingLineFeed = False, bool withTrailingSpace = True)

ProtectedStaticKeyword

SyntaxTokenList ProtectedStaticKeyword(bool withLeadingLineFeed = False, bool withTrailingSpace = True)

PublicAsyncKeyword

SyntaxTokenList PublicAsyncKeyword(bool withLeadingLineFeed = False, bool withTrailingSpace = True)

PublicKeyword

SyntaxTokenList PublicKeyword(bool withLeadingLineFeed = False, bool withTrailingSpace = True)

Summary: Creates a token list with the public keyword.

Parameters:
     withLeadingLineFeed  -  If true, adds a leading line feed.
     withTrailingSpace  -  If true, adds a trailing space.

Returns: A Microsoft.CodeAnalysis.SyntaxTokenList containing the public modifier.

PublicOverrideKeyword

SyntaxTokenList PublicOverrideKeyword(bool withLeadingLineFeed = False, bool withTrailingSpace = True)

PublicStaticKeyword

SyntaxTokenList PublicStaticKeyword(bool withLeadingLineFeed = False, bool withTrailingSpace = True)

SyntaxTypeArgumentListFactory

Factory for creating Microsoft.CodeAnalysis.CSharp.Syntax.TypeArgumentListSyntax nodes.

public static class SyntaxTypeArgumentListFactory

Static Methods

CreateWithOneItem

TypeArgumentListSyntax CreateWithOneItem(string typeName)

Summary: Creates a type argument list with a single type.

Parameters:
     typeName  -  The name of the type argument.

Returns: A Microsoft.CodeAnalysis.CSharp.Syntax.TypeArgumentListSyntax containing one type.

CreateWithTwoItems

TypeArgumentListSyntax CreateWithTwoItems(string typeName1, string typeName2)

Summary: Creates a type argument list with two types.

Parameters:
     typeName1  -  The name of the first type argument.
     typeName2  -  The name of the second type argument.

Returns: A Microsoft.CodeAnalysis.CSharp.Syntax.TypeArgumentListSyntax containing two types.


SyntaxVariableDeclarationFactory

Factory for creating Microsoft.CodeAnalysis.CSharp.Syntax.VariableDeclarationSyntax nodes.

public static class SyntaxVariableDeclarationFactory

Static Methods

Create

VariableDeclarationSyntax Create(string identifierTypeName, string identifierName)

Summary: Creates a variable declaration.

Parameters:
     identifierTypeName  -  The type name of the variable.
     identifierName  -  The name of the variable.

Returns: A Microsoft.CodeAnalysis.CSharp.Syntax.VariableDeclarationSyntax node.


Generated by MarkdownCodeDoc version 1.2