Class CsMethodExtensions
Extensions class that provides common automation tasks rolled up under standard extension methods that support the CsMethod model.
Inherited Members
Namespace: CodeFactory.Formatting.CSharp
Assembly: CodeFactory.Formatting.CSharp.dll
Syntax
public static class CsMethodExtensions
Methods
| Improve this Doc View SourceCSharpFormatInterfaceMethodSignature(CsMethod, NamespaceManager)
Returns a standard C# method signature for use in interface definitions
Declaration
public static string CSharpFormatInterfaceMethodSignature(this CsMethod source, NamespaceManager manager = null)
Parameters
Type | Name | Description |
---|---|---|
CsMethod | source | The source method to extract the signature from. |
NamespaceManager | manager | Optional parameter that contains all the using statements from the source code, when used will replace namespaces on type definition in code. |
Returns
Type | Description |
---|---|
string | The c# formatted signature of a standard method signature with the async keyword when supported |
CSharpFormatMethodSignature(CsMethod, NamespaceManager, bool, bool, CsSecurity, bool, bool)
Generates a C# method signature from model data. This provides a fully customizable method for generating the signature.
Declaration
public static string CSharpFormatMethodSignature(this CsMethod source, NamespaceManager manager = null, bool includeAsyncKeyword = true, bool includeSecurity = true, CsSecurity methodSecurity = CsSecurity.Unknown, bool includeKeywords = true, bool includeAbstractKeyword = false)
Parameters
Type | Name | Description |
---|---|---|
CsMethod | source | The source method data to generate the signature from. |
NamespaceManager | manager | Optional parameter that contains all the using statements from the source code, when used will replace namespaces on type definition in code. |
bool | includeAsyncKeyword | Include the async keyword if the return type is Task |
bool | includeSecurity | Includes the security scope which was defined in the model. |
CsSecurity | methodSecurity | Optional parameter that allows you to set the security scope for the method. |
bool | includeKeywords | Includes all keywords assigned to the source model. |
bool | includeAbstractKeyword | Will include the definition for the abstract keyword in the definition if it is defined. default is false. |
Returns
Type | Description |
---|---|
string | Fully formatted method deceleration or null if the method data was missing. |
CSharpFormatStandardMethodSignature(CsMethod, NamespaceManager)
Returns a standard C# method signature
Declaration
public static string CSharpFormatStandardMethodSignature(this CsMethod source, NamespaceManager manager = null)
Parameters
Type | Name | Description |
---|---|---|
CsMethod | source | The source method to extract the signature from. |
NamespaceManager | manager | Optional parameter that contains all the using statements from the source code, when used will replace namespaces on type definition in code. |
Returns
Type | Description |
---|---|
string | The c# formatted signature of a standard method signature |
CSharpFormatStandardMethodSignatureWithAsync(CsMethod, NamespaceManager)
Returns a standard C# method signature the the async keyword when supported.
Declaration
public static string CSharpFormatStandardMethodSignatureWithAsync(this CsMethod source, NamespaceManager manager = null)
Parameters
Type | Name | Description |
---|---|---|
CsMethod | source | The source method to extract the signature from. |
NamespaceManager | manager | Optional parameter that contains all the using statements from the source code, when used will replace namespaces on type definition in code. |
Returns
Type | Description |
---|---|
string | The c# formatted signature of a standard method signature with the async keyword when supported |