예제 #1
0
        /// <summary>
        /// Write out an extension method reference
        /// </summary>
        /// <param name="extMethod">The extension method reference information</param>
        /// <param name="options">The link display options</param>
        /// <param name="writer">The write to which the information is written</param>
        public void WriteExtensionMethod(ExtensionMethodReference extMethod, DisplayOptions options, XmlWriter writer)
        {
            if (extMethod == null)
            {
                throw new ArgumentNullException("extMethod");
            }

            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            // write the unqualified method name
            writer.WriteString(extMethod.Name);

            // if this is a generic method, write any template params or args
            if (extMethod.TemplateArgs != null && extMethod.TemplateArgs.Count > 0)
            {
                WriteTemplateArguments(extMethod.TemplateArgs, writer);
            }

            // write parameters
            if ((options & DisplayOptions.ShowParameters) > 0)
            {
                WriteMethodParameters(extMethod.Parameters, writer);
            }
        }
예제 #2
0
        /// <summary>
        /// Write out a reference
        /// </summary>
        /// <param name="reference">The reference information</param>
        /// <param name="options">The link display options</param>
        /// <param name="writer">The write to which the information is written</param>
        public void WriteReference(Reference reference, DisplayOptions options, XmlWriter writer)
        {
            if (reference == null)
            {
                throw new ArgumentNullException("reference");
            }

            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            NamespaceReference space = reference as NamespaceReference;

            if (space != null)
            {
                WriteNamespace(space, writer);
                return;
            }

            TypeReference type = reference as TypeReference;

            if (type != null)
            {
                WriteType(type, options, writer);
                return;
            }

            MemberReference member = reference as MemberReference;

            if (member != null)
            {
                WriteMember(member, options, writer);
                return;
            }

            ExtensionMethodReference extMethod = reference as ExtensionMethodReference;

            if (extMethod != null)
            {
                WriteExtensionMethod(extMethod, options, writer);
                return;
            }

            InvalidReference invalid = reference as InvalidReference;

            if (invalid != null)
            {
                WriteInvalid(invalid, writer);
                return;
            }

            throw new InvalidOperationException("Unknown target type");
        }
예제 #3
0
        /// <summary>
        /// Write out an extension method reference
        /// </summary>
        /// <param name="extMethod">The extension method reference information</param>
        /// <param name="options">The link display options</param>
        /// <param name="writer">The write to which the information is written</param>
        public void WriteExtensionMethod(ExtensionMethodReference extMethod, DisplayOptions options, XmlWriter writer)
        {
            if(extMethod == null)
                throw new ArgumentNullException("extMethod");

            if(writer == null)
                throw new ArgumentNullException("writer");

            // write the unqualified method name
            writer.WriteString(extMethod.Name);

            // if this is a generic method, write any template params or args
            if(extMethod.TemplateArgs != null && extMethod.TemplateArgs.Count > 0)
                WriteTemplateArguments(extMethod.TemplateArgs, writer);

            // write parameters
            if((options & DisplayOptions.ShowParameters) > 0)
                WriteMethodParameters(extMethod.Parameters, writer);
        }