Class GenerateCSharpMethodExtensions
Extension methods that support the generation of source in the C# language from the CsMethod model.
Inherited Members
Namespace: CodeFactory.WinVs.Models.CSharp
Assembly: CodeFactory.WinVs.dll
Syntax
public static class GenerateCSharpMethodExtensions
Methods
GenerateCSharpMethodName(CsMethod, bool, string, string, string, string)
Creates a full formatted method name from a source method model
Declaration
public static string GenerateCSharpMethodName(this CsMethod source, bool forceAsyncMethod = false, string namePrefix = null, string nameSuffix = null, string asyncPrefix = null, string asyncSuffix = null)
Parameters
Type | Name | Description |
---|---|---|
CsMethod | source | Method model to generate the name from. |
bool | forceAsyncMethod | Optional, determines if the method name should be forced for async method, default is false. |
string | namePrefix | Optional,prefix to be added to the name, default is null. |
string | nameSuffix | Optional,suffix to be added to the name, default is null. |
string | asyncPrefix | Optional,prefix to be added to the name if it is a async method, default is null. |
string | asyncSuffix | Optional,suffix to be added to the name if it is a async method, default is null. |
Returns
Type | Description |
---|---|
string |
GenerateCSharpMethodSignature(CsMethod, NamespaceManager, bool, bool, CsSecurity, bool, bool, bool, bool, bool, bool, bool, List<MapNamespace>, bool, string, string, bool, string, string, string)
Generates a C# method signature from model data. This provides a fully customizable method for generating the signature.
Declaration
public static string GenerateCSharpMethodSignature(this CsMethod source, NamespaceManager manager = null, bool includeAsyncKeyword = true, bool includeSecurity = true, CsSecurity methodSecurity = CsSecurity.Unknown, bool includeKeywords = true, bool abstractKeyword = false, bool sealedKeyword = false, bool staticKeyword = false, bool virtualKeyword = false, bool overrideKeyword = false, bool includeAbstractKeyword = false, List<MapNamespace> mappedNamespaces = null, bool forceAsyncDefinition = false, string asyncPrefix = null, string asyncSuffix = null, bool isInterfaceSignature = false, string methodName = null, string namePrefix = null, string nameSuffix = null)
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 | abstractKeyword | Optional flag that will add the abstract keyword to the method signature,default is false. |
bool | sealedKeyword | Optional flag that will add the sealed keyword to the method signature, default is false. |
bool | staticKeyword | Optional flag that will add the static keyword to the method signature, default is false. |
bool | virtualKeyword | Optional flag that will add the static keyword to the method signature, default is false. |
bool | overrideKeyword | Optional flag that will add the override keyword to the method signature, default is false. |
bool | includeAbstractKeyword | Will include the definition for the abstract keyword in the definition if it is defined. default is false. |
List<MapNamespace> | mappedNamespaces | Optional parameter that provides namespaces to be mapped to. |
bool | forceAsyncDefinition | Optional parameter that forces the method to confirm to an async signature, default value is false. |
string | asyncPrefix | Optional parameter that is used with forceAsyncDefinition that includes an expected prefix on the method name, default value is null. |
string | asyncSuffix | Optional parameter that is used with forceAsyncDefinition that includes an expected suffix on the method name, default value is null. |
bool | isInterfaceSignature | Optional parameter used to determine if the method is being built for a interface definition, default value is null. |
string | methodName | Optional parameter that sets what the methods name will return as with the signature. |
string | namePrefix | Optional parameter that determines if the name will have a prefix assigned to it, default is null. |
string | nameSuffix | Optional parameter that determines if the name will have a prefix assigned to it, default is null. |
Returns
Type | Description |
---|---|
string | Fully formatted method deceleration or null if the method data was missing. |