Convert.ToXmlDocCommentMember

Dec 15, 2012 at 1:17 PM

Not a full patch, but maybe you want to add this to the Convert class:

        /// <summary>
        /// Creates the XML doc comment member reference string
        /// for a given <see cref="System.Reflection.MemberInfo"/>.
        /// </summary>
        /// 
        /// <param name="member">
        /// The <see cref="System.Reflection.MemberInfo"/> to convert.
        /// </param>
        /// 
        /// <returns>
        /// A string containing the requested member reference.
        /// </returns>
        public static string ToXmlDocCommentMember(this MemberInfo member)
        {
            switch (member.MemberType)
            {
                case MemberTypes.Constructor: 
                    return ToXmlDocCommentMember((ConstructorInfo)member);
                case MemberTypes.Method: 
                    return ToXmlDocCommentMember((MethodInfo)member);
                case MemberTypes.Event: 
                    return ToXmlDocCommentMember((EventInfo)member);
                case MemberTypes.Field: 
                    return ToXmlDocCommentMember((FieldInfo)member);
                case MemberTypes.NestedType:
                case MemberTypes.TypeInfo: 
                return Jolt.Convert.ToXmlDocCommentMember((Type)member);
                case MemberTypes.Property:
                    return Jolt.Convert.ToXmlDocCommentMember((PropertyInfo)member);
                default:
                    throw new ArgumentException("Unknown member type", "member");
            }
        }