/// <summary> /// Converts the object passed in to its XML representation. /// The XML string is written on the XmlTextWriter. /// </summary> public void ToXml(object value, FieldInfo field, XmlTextWriter xml, IMarshalContext context) { MethodInfo info = value as MethodInfo; ParameterInfo[] paramList = info.GetParameters(); if (info.ReflectedType == null) { throw new ConversionException("Unable to serialize MethodInfo, no reflected type."); } context.WriteStartTag(__type, field, xml); xml.WriteElementString("base", context.GetTypeName(info.ReflectedType)); xml.WriteElementString("name", info.Name); xml.WriteStartElement("params"); foreach (ParameterInfo paramInfo in paramList) { xml.WriteElementString("param", context.GetTypeName(paramInfo.ParameterType)); } xml.WriteEndElement(); context.WriteEndTag(__type, field, xml); }
/// <summary> /// Converts the object passed in to its XML representation. /// The XML string is written on the XmlTextWriter. /// </summary> public void ToXml(object value, FieldInfo field, XmlTextWriter xml, IMarshalContext context) { MethodInfo info = value as MethodInfo; ParameterInfo[] paramList = info.GetParameters(); if ( info.ReflectedType == null ) throw new ConversionException( "Unable to serialize MethodInfo, no reflected type." ); context.WriteStartTag( __type, field, xml ); xml.WriteElementString( "base", context.GetTypeName( info.ReflectedType ) ); xml.WriteElementString( "name", info.Name ); xml.WriteStartElement( "params" ); foreach ( ParameterInfo paramInfo in paramList ) xml.WriteElementString( "param", context.GetTypeName( paramInfo.ParameterType ) ); xml.WriteEndElement(); context.WriteEndTag( __type, field, xml ); }