Exemplo n.º 1
0
        private void WriteMethod(MethodTarget target, DisplayOptions options, XmlWriter writer,
                                 Dictionary <IndexedTemplateTypeReference, TypeReference> dictionary)
        {
            WriteProcedureName(target, writer);

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

            if ((options & DisplayOptions.ShowParameters) > 0)
            {
                if (target.IsConversionOperator)
                {
                    WriteConversionOperatorParameters(target.Parameters, target.ReturnType, writer, dictionary);
                }
                else
                {
                    WriteMethodParameters(target.Parameters, writer, dictionary);
                }
            }
        }
Exemplo n.º 2
0
        private void WriteMemberTarget(MemberTarget target, DisplayOptions options, XmlWriter writer, Dictionary <IndexedTemplateTypeReference, TypeReference> dictionary)
        {
            if (target == null)
            {
                throw new ArgumentNullException(nameof(target));
            }

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

            MethodTarget method = target as MethodTarget;

            if ((options & DisplayOptions.ShowContainer) > 0)
            {
                WriteType(target.ContainingType, options & ~DisplayOptions.ShowContainer, writer);

                if (method != null && method.IsConversionOperator)
                {
                    writer.WriteString(" ");
                }
                else
                {
                    WriteSeparator(writer);
                }
            }

            // special logic for writing methods
            if (method != null)
            {
                WriteMethod(method, options, writer, dictionary);
                return;
            }

            // special logic for writing properties
            if (target is PropertyTarget property)
            {
                WriteProperty(property, options, writer);
                return;
            }

            // special logic for writing constructors
            if (target is ConstructorTarget constructor)
            {
                WriteConstructor(constructor, options, writer);
                return;
            }

            // special logic for writing events
            if (target is EventTarget trigger)
            {
                WriteEvent(trigger, writer);
                return;
            }

            // by default, just write name
            writer.WriteString(target.Name);
        }