Beispiel #1
0
        string TypeToString(ConvertTypeOptions options, TypeReference type, ICustomAttributeProvider typeAttributes = null)
        {
            AstType astType = CSharpDecompiler.ConvertType(type, typeAttributes, options);

            StringWriter w = new StringWriter();

            if (type.IsByReference)
            {
                ParameterDefinition pd = typeAttributes as ParameterDefinition;
                if (pd != null && (!pd.IsIn && pd.IsOut))
                {
                    w.Write("out ");
                }
                else
                {
                    w.Write("ref ");
                }

                if (astType is ComposedType && ((ComposedType)astType).PointerRank > 0)
                {
                    ((ComposedType)astType).PointerRank--;
                }
            }

            astType.AcceptVisitor(new CSharpOutputVisitor(w, TypeToStringFormattingOptions));
            return(w.ToString());
        }