Ejemplo n.º 1
0
        /// <summary>
        /// Write out a member reference
        /// </summary>
        /// <param name="member">The member 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 WriteMember(MemberReference member, DisplayOptions options, XmlWriter writer)
        {
            if (member == null)
            {
                throw new ArgumentNullException("member");
            }

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

            SimpleMemberReference simple = member as SimpleMemberReference;

            if (simple != null)
            {
                WriteSimpleMember(simple, options, writer);
                return;
            }

            SpecializedMemberReference special = member as SpecializedMemberReference;

            if (special != null)
            {
                WriteSpecializedMember(special, options, writer);
                return;
            }

            SpecializedMemberWithParametersReference ugly = member as SpecializedMemberWithParametersReference;

            if (ugly != null)
            {
                WriteSpecializedMemberWithParameters(ugly, options, writer);
                return;
            }

            throw new InvalidOperationException("Unknown member reference type");
        }
Ejemplo n.º 2
0
        private void WriteSpecializedMemberWithParameters(SpecializedMemberWithParametersReference ugly, DisplayOptions options, XmlWriter writer)
        {
            if((options & DisplayOptions.ShowContainer) > 0)
            {
                WriteSpecializedType(ugly.SpecializedType, options & ~DisplayOptions.ShowContainer, writer);
                WriteSeparator(writer);
            }

            writer.WriteString(ugly.MemberName);

            if((options & DisplayOptions.ShowParameters) > 0)
            {
                writer.WriteString("(");

                IList<TypeReference> parameterTypes = ugly.ParameterTypes;

                for(int i = 0; i < parameterTypes.Count; i++)
                {
                    if(i > 0)
                        writer.WriteString(", ");

                    WriteType(parameterTypes[i], DisplayOptions.Default, writer);
                }

                writer.WriteString(")");
            }
        }