Example #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentationBase"/> class.
 /// </summary>
 /// <param name="memberDefinition">The <see cref="IMemberDefinition"/> which to document.</param>
 /// <param name="xElement">The XML element representing the XML comments for the current member.</param>
 /// <param name="declaringType">The type which declares this member.</param>
 public DocumentationBase(IMemberDefinition memberDefinition, XElement xElement, TypeDocumentation declaringType)
 {
     this.MemberDefinition = memberDefinition;
     this.XElement         = xElement;
     this.DeclaringType    = declaringType;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="PropertyDocumentation"/> class.
        /// </summary>
        /// <param name="propertyDefinition">The <see cref="PropertyDefinition"/> which to document.</param>
        /// <param name="xElement">The XML element representing the XML comments for the current member.</param>
        /// <param name="handle">The <see cref="EntityHandle"/> that represents the member to document.</param>
        /// <param name="declaringType">The type which declares this member.</param>
        public PropertyDocumentation(PropertyDefinition propertyDefinition, XElement xElement, EntityHandle handle, TypeDocumentation declaringType)
            : base(propertyDefinition, xElement, declaringType)
        {
            var declaringAssembly = declaringType.DeclaringAssembly;

            this.Declaration = declaringAssembly.Decompiler.DecompileAsString(handle).Trim();
        }
Example #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MethodDocumentation"/> class.
        /// </summary>
        /// <param name="methodDefinition">The <see cref="MethodDefinition"/> which to document.</param>
        /// <param name="xElement">The XML element representing the XML comments for the current member.</param>
        /// <param name="handle">The <see cref="EntityHandle"/> that represents the member to document.</param>
        /// <param name="declaringType">The type which declares this member.</param>
        public MethodDocumentation(MethodDefinition methodDefinition, XElement xElement, EntityHandle handle, TypeDocumentation declaringType)
            : base(methodDefinition, xElement, declaringType)
        {
            this.ParameterDocumentations  = this.GetParameterDocumentations(methodDefinition, xElement);
            this.ReturnValueDocumentation = new ReturnValueDocumentation(methodDefinition.MethodReturnType, (from x in xElement.Descendants()
                                                                                                             where x.Name == "returns"
                                                                                                             select x).SingleOrDefault());

            var declaringAssembly = declaringType.DeclaringAssembly;

            this.Declaration = declaringAssembly.Decompiler.DecompileAsString(handle).Trim();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="FieldDocumentation"/> class.
        /// </summary>
        /// <param name="fieldDefinition">The <see cref="FieldDefinition"/> which to document.</param>
        /// <param name="xElement">The XML element representing the XML comments for the current member.</param>
        /// <param name="handle">The <see cref="EntityHandle"/> that represents the member to document.</param>
        /// <param name="declaringType">The type which declares this member.</param>
        public FieldDocumentation(FieldDefinition fieldDefinition, XElement xElement, EntityHandle handle, TypeDocumentation declaringType)
            : base(fieldDefinition, xElement, declaringType)
        {
            var declaringAssembly = declaringType.DeclaringAssembly;

            this.Declaration = declaringAssembly.Decompiler.DecompileAsString(handle).Trim();

            if (this.Declaration.Contains("="))
            {
                this.Declaration = $"{this.Declaration.Substring(0, this.Declaration.IndexOf('=')).Trim()};";
            }
        }