Esempio n. 1
0
        internal static string GetDocumentation(Type type)
        {
            // Python documentation
            object[] docAttr = type.GetCustomAttributes(typeof(DocumentationAttribute), false);
            if (docAttr != null && docAttr.Length > 0)
            {
                return(((DocumentationAttribute)docAttr[0]).Documentation);
            }

            if (type == typeof(DynamicNull))
            {
                return(null);
            }

            // Auto Doc (XML or otherwise)
            string autoDoc = DocBuilder.CreateAutoDoc(type);

            if (autoDoc == null)
            {
                autoDoc = String.Empty;
            }
            else
            {
                autoDoc += Environment.NewLine + Environment.NewLine;
            }

            // Simple generated helpbased on ctor, if available.
            ConstructorInfo[] cis = type.GetConstructors();
            foreach (ConstructorInfo ci in cis)
            {
                autoDoc += FixCtorDoc(type, DocBuilder.CreateAutoDoc(ci, DynamicHelpers.GetPythonTypeFromType(type).Name, 0)) + Environment.NewLine;
            }

            return(autoDoc);
        }