I’ve
been doing a lot of work with the .NET XmlSerializer over the last couple of
weeks, and once again I’m wishing I had that just one more custom
attribute to work with. What I’d love to be able to do is just tell
the XmlSerializer to let me worry about a specific part of the XML, since I
know better than it.

Something like
this (to serialize a property called MyString):

publicinterface
ICustomSerializer

{

void DoSerialization(object
theValue, XmlTextWriter w);

void DoDeserialization(XmlNode x, object targetValue)

}

publicclass
DataClass

{

public DataClass()

{

}

[XmlMyWay(typeof(MySerializer))]

publicstring
MyString

{

get{ return
"OK";}

set{}

}

}

[AttributeUsage(AttributeTargets.Property)]

publicclass
XmlMyWayAttribute : Attribute

{

public XmlMyWayAttribute(Type serializer)

{

}

}

publicclass
MySerializer : ICustomSerializer

{

#region
ICustomSerializer Members

publicvoid
DoSerialization(object theValue, XmlTextWriter
w)

{

// TODO: Add MySerializer.DoSerialization
implementation

}

publicvoid
DoDeserialization(XmlNode x, object
targetValue)

{

// TODO: Add MySerializer.DoDeserialization
implementation

}

#endregion

}

Then
you could do whatever funky serialization you needed to do. Or is this
flawed in some fundamental way? It’d be pretty cool though…