Class CsModelExtensions
Static class that stores extension methods that support all models that derive from ICsModel
Inherited Members
Namespace: CodeFactory.DotNet.CSharp
Assembly: CodeFactory.DotNet.dll
Syntax
public static class CsModelExtensions
Methods
| Improve this Doc View SourceFormatCSharpArraySignatureSyntax(CsType)
Extension method that creates the array portion definition of a type definition in C# syntax.
Declaration
public static string FormatCSharpArraySignatureSyntax(this CsType source)
Parameters
Type | Name | Description |
---|---|---|
CsType | source | The source type to get the array information to format. |
Returns
Type | Description |
---|---|
string | The formatted array syntax for the target type, or null if no array data was provided in the type definition. |
FormatCSharpAttributeParametersSignatureSyntax(IReadOnlyList<CsAttributeParameter>)
Extension method that creates the attributes parameters list for a attribute definition in c# syntax format.
Declaration
public static string FormatCSharpAttributeParametersSignatureSyntax(this IReadOnlyList<CsAttributeParameter> source)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyList<CsAttributeParameter> | source | THe source list of parameters to be created. |
Returns
Type | Description |
---|---|
string | The fully formatted parameters section of a attribute declaration. |
FormatCSharpAttributeParameterValueSignatureSyntax(CsAttributeParameterValue)
Creates the implementation of an attribute value formatted for c#.
Declaration
public static string FormatCSharpAttributeParameterValueSignatureSyntax(this CsAttributeParameterValue source)
Parameters
Type | Name | Description |
---|---|---|
CsAttributeParameterValue | source | The source value to format. |
Returns
Type | Description |
---|---|
string | The formatted value, or null if the model does not exist. |
FormatCSharpAttributeSignatureSyntax(CsAttribute)
Extension method that returns a full attribute declaration in the C# language format.
Declaration
public static string FormatCSharpAttributeSignatureSyntax(this CsAttribute source)
Parameters
Type | Name | Description |
---|---|---|
CsAttribute | source | The attribute toe generate the c# signature for. |
Returns
Type | Description |
---|---|
string |
FormatCSharpEnumTypeSyntax(CsEnum, string)
Extension method that will lookup the enumeration type based on the provided value.
Declaration
public static string FormatCSharpEnumTypeSyntax(this CsEnum source, string value)
Parameters
Type | Name | Description |
---|---|---|
CsEnum | source | The target CsEnum model to get the enumeration type from. |
string | value | The target numerical value to use to lookup the enumeration type. |
Returns
Type | Description |
---|---|
string | The fully qualified enumeration type or null if the enumeration type could not be found. |
FormatCSharpEnumValueSyntax(CsEnum, string)
Extension method that will lookup the value of an enumeration by the enumeration type name.
Declaration
public static string FormatCSharpEnumValueSyntax(this CsEnum source, string enumName)
Parameters
Type | Name | Description |
---|---|---|
CsEnum | source | The target IDotNetEnum model to get the enumeration value from. |
string | enumName | The target numerical named item to use to lookup the enumeration value. |
Returns
Type | Description |
---|---|
string | The target enumeration value or null if it could not be found. |
FormatCSharpFullTypeName(CsType)
Extension method that generates the fully qualified type name from the ICsType model in the C# format.
Declaration
public static string FormatCSharpFullTypeName(this CsType source)
Parameters
Type | Name | Description |
---|---|---|
CsType | source | The source type to get the full type name from. |
Returns
Type | Description |
---|---|
string | The fully qualified namespace and full type definition. Null if the type is missing or not loaded. |
FormatCSharpGenericSignatureSyntax(IReadOnlyList<CsGenericParameter>)
Extension method that generates the generics definition part of a signature in the c# format.
Declaration
public static string FormatCSharpGenericSignatureSyntax(this IReadOnlyList<CsGenericParameter> source)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyList<CsGenericParameter> | source | The target types that make up the generics signature. |
Returns
Type | Description |
---|---|
string | The fully formatted definition of the generics signature, or null if the source is not provided. |
FormatCSharpGenericWhereClauseSyntax(CsGenericParameter)
Extension method that generates the where clause for a generic parameter if one exists. This will not generate if the generic parameter is not a place holder type, or if no where clause conditions have been provided.
Declaration
public static string FormatCSharpGenericWhereClauseSyntax(this CsGenericParameter source)
Parameters
Type | Name | Description |
---|---|---|
CsGenericParameter | source | Generic parameter to generate the where clause from. |
Returns
Type | Description |
---|---|
string | Null if the where clause was not generated, or the C# syntax for the where clause. |
FormatCSharpParameterDefaultValueSyntax(CsParameterDefaultValue, CsType)
Extension method that generates the default value syntax for a parameter in the C# language.
Declaration
public static string FormatCSharpParameterDefaultValueSyntax(this CsParameterDefaultValue source, CsType type)
Parameters
Type | Name | Description |
---|---|---|
CsParameterDefaultValue | source | The target default value to format. |
CsType | type | The target type of the value to be formatted. |
Returns
Type | Description |
---|---|
string | The fully formatted syntax for the default value or null if data was missing. |
FormatCSharpParametersSignatureSyntax(IReadOnlyList<CsParameter>)
Extension method that create the fully formatted parameters section in c# syntax.
Declaration
public static string FormatCSharpParametersSignatureSyntax(this IReadOnlyList<CsParameter> source)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyList<CsParameter> | source | The source list of parameters to be turned into a parameters signature. |
Returns
Type | Description |
---|---|
string | The fully formatted parameters signature or null if data was missing. |
FormatCSharpSyntax(CsSecurity)
Gets the security keyword for the C# language.
Declaration
public static string FormatCSharpSyntax(this CsSecurity source)
Parameters
Type | Name | Description |
---|---|---|
CsSecurity | source | The source security object to get the keyword from. |
Returns
Type | Description |
---|---|
string | The name of the security keyword or null. |
FormatCSharpTupleSignatureSyntax(CsType)
Extension method that creates a C# signature for the tuple type.
Declaration
public static string FormatCSharpTupleSignatureSyntax(this CsType source)
Parameters
Type | Name | Description |
---|---|---|
CsType | source | The target declaration syntax for a tuple. |
Returns
Type | Description |
---|---|
string | The formatted tuple or null if data is missing. |
FormatCSharpValueSyntax(CsType, string)
Extension method that returns a value declaration in the c# language format.
Declaration
public static string FormatCSharpValueSyntax(this CsType source, string value)
Parameters
Type | Name | Description |
---|---|---|
CsType | source | The target type to create the value definition for. |
string | value | The value to be formatted. |
Returns
Type | Description |
---|---|
string | The definition of the value formatted for C# |