Source/NFX/MiscUtils.cs
/// <summary>
/// Returns the full name of the type optionally prefixed with verbatim id specifier '@'.
/// The generic arguments ar expanded into their full names i.e.
///   List'1[System.Object]  ->  System.Collections.Generic.List&lt;System.Object&gt;
/// </summary>
Returns the full name of the type optionally prefixed with verbatim id specifier '@'.
The generic arguments ar expanded into their full names i.e.
Returns the full name of the type optionally prefixed with verbatim id specifier ' @ ' . The generic arguments ar expanded into their full names i . e .
public static string FullNameWithExpandedGenericArgs(this Type type, bool verbatimPrefix = true)
    {
        var ns = type.Namespace;
        if (verbatimPrefix)
        {
            var nss = ns.Split('.');
            ns = string.Join(".@", nss);
        }
        var gargs = type.GetGenericArguments();
        if (gargs.Length==0)
        {
         return verbatimPrefix ? "@{0}.{1}".Args( ns, type.FullNestedTypeName(true)) : (type.Namespace+'.'+type.FullNestedTypeName(false));
        }
        var sb = new StringBuilder();
        for(int i=0; i<gargs.Length; i++)
        {
            if (i>0) sb.Append(", ");
            sb.Append( gargs[i].FullNameWithExpandedGenericArgs(verbatimPrefix) );
        }
        var nm = type.FullNestedTypeName(verbatimPrefix);
        var idx = nm.IndexOf('`');
        if(idx>=0)
            nm = nm.Substring(0, idx);
        return verbatimPrefix ? "@{0}.{1}<{2}>".Args(ns, nm, sb.ToString()) :
                                "{0}.{1}<{2}>".Args(ns, nm, sb.ToString());
    }
public static string FullNameWithExpandedGenericArgs ( this Type type , bool verbatimPrefix = true ) { var ns = type . Namespace ; if ( verbatimPrefix ) { var nss = ns . Split ( ' ' ) ; ns = string . Join ( " " , nss ) ; } var gargs = type . GetGenericArguments ( ) ; if ( gargs . Length == 0 ) { return verbatimPrefix ? " " . Args ( ns , type . FullNestedTypeName ( true ) ) : ( type . Namespace + ' ' + type . FullNestedTypeName ( false ) ) ; } var sb = new StringBuilder ( ) ; for ( int i = 0 ; i < gargs . Length ; i ++ ) { if ( i > 0 ) sb . Append ( " " ) ; sb . Append ( gargs [ i ] . FullNameWithExpandedGenericArgs ( verbatimPrefix ) ) ; } var nm = type . FullNestedTypeName ( verbatimPrefix ) ; var idx = nm . IndexOf ( ' ' ) ; if ( idx >= 0 ) nm = nm . Substring ( 0 , idx ) ; return verbatimPrefix ? " " . Args ( ns , nm , sb . ToString ( ) ) : " " . Args ( ns , nm , sb . ToString ( ) ) ; }
Returns the full name of the type optionally prefixed with verbatim id specifier '@'.
Returns the full name of the type optionally prefixed with verbatim id specifier ' @ ' .
Type
this
verbatimPrefix
bool