CodeFactory for Windows CodeFactory for Windows
CodeFactory for Windows CodeFactory for Windows
CodeFactory

Search Results for

    Class GenereateCSharpTypeExtensions

    Extension methods that support the generation of source in the C# language from the CsType model.

    Inheritance
    object
    GenereateCSharpTypeExtensions
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: CodeFactory.WinVs.Models.CSharp
    Assembly: CodeFactory.WinVs.dll
    Syntax
    public static class GenereateCSharpTypeExtensions

    Methods

    GenerateCSharpArraySignature(CsType)

    Extension method that creates the array portion definition of a type definition in C# syntax.

    Declaration
    public static string GenerateCSharpArraySignature(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.

    GenerateCSharpDefaultValue(CsType)

    Gets an initial default value syntax for the target type. This will generally be used on the right side of a = sign.

    Declaration
    public static string GenerateCSharpDefaultValue(this CsType source)
    Parameters
    Type Name Description
    CsType source

    Type to generate syntax for.

    Returns
    Type Description
    string

    Formatted C# syntax for the default value, or null if the default value syntax cannot be identified.

    Exceptions
    Type Condition
    ArgumentNullException

    Instance of the type was not provided.

    GenerateCSharpGenericParametersSignature(IReadOnlyList<CsGenericParameter>, NamespaceManager, List<MapNamespace>)

    Extension method that generates the generics definition part of a signature in the C# format.

    Declaration
    public static string GenerateCSharpGenericParametersSignature(this IReadOnlyList<CsGenericParameter> source, NamespaceManager manager = null, List<MapNamespace> mappedNamespaces = null)
    Parameters
    Type Name Description
    IReadOnlyList<CsGenericParameter> source

    The target types that make up the generics signature.

    NamespaceManager manager

    Optional parameter that contains all the using statements from the source code, when used will replace namespaces on type definition in code.

    List<MapNamespace> mappedNamespaces

    Optional parameter that provides namespaces to be mapped to.

    Returns
    Type Description
    string

    The fully formatted definition of the generics signature, or null if the source is not provided.

    GenerateCSharpTupleSignature(CsType, NamespaceManager, List<MapNamespace>)

    Extension method that creates a C# signature for the tuple type.

    Declaration
    public static string GenerateCSharpTupleSignature(this CsType source, NamespaceManager manager = null, List<MapNamespace> mappedNamespaces = null)
    Parameters
    Type Name Description
    CsType source

    The target declaration syntax for a tuple.

    NamespaceManager manager

    Optional parameter that contains all the using statements from the source code, when used will replace namespaces on type definition in code.

    List<MapNamespace> mappedNamespaces

    Optional parameter that provides namespaces to be mapped to.

    Returns
    Type Description
    string

    The formatted tuple or null if data is missing.

    GenerateCSharpTypeName(CsType, NamespaceManager, List<MapNamespace>)

    Formats a type name to match the C# syntax for a type deceleration in C#.

    Declaration
    public static string GenerateCSharpTypeName(this CsType source, NamespaceManager manager = null, List<MapNamespace> mappedNamespaces = null)
    Parameters
    Type Name Description
    CsType source

    The type model to use to generate the type signature for c#

    NamespaceManager manager

    Optional parameter that contains all the using statements from the source code, when used will replace namespaces on type definition in code.

    List<MapNamespace> mappedNamespaces

    Optional parameter that provides namespaces to be mapped to.

    Returns
    Type Description
    string

    The formatted type definition for C#

    GenerateCSharpTypeNameRemoveNullableDefinition(CsType, NamespaceManager, List<MapNamespace>)

    Formats a CsType into a C# compliant type name. If the type is nullable it return the non nullable version of the type.

    Declaration
    public static string GenerateCSharpTypeNameRemoveNullableDefinition(this CsType source, NamespaceManager manager = null, List<MapNamespace> mappedNamespaces = null)
    Parameters
    Type Name Description
    CsType source

    The type to generate the c# type name from.

    NamespaceManager manager

    Namespace manager that will determine what namespaces can be truncated from the name of the type. This is an optional parameter.

    List<MapNamespace> mappedNamespaces

    Optional parameter that provides namespaces to be mapped to.

    Returns
    Type Description
    string

    The fully formatted c# type name.

    Exceptions
    Type Condition
    ArgumentNullException

    If the source type is null will throw an exception.

    CodeFactoryException

    If the nullable base type cannot be determined.

    GenerateCSharpValueSyntax(CsType, string)

    Extension method that returns a value declaration in the C# language format.

    Declaration
    public static string GenerateCSharpValueSyntax(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#

    © CodeFactory, LLC. All rights reserved.