Hello, I have some trouble on how I should start on this one:
I want to create a function that can handle all of the above types and serilize them, so far I have this to serilize a normal object:
Like how to parse them to the function and thereafter detect which is which and do the different procedure for each case.Code:Public Function SerializeToXmlDocument(ByVal ObjInput As Object, Optional ByVal ParentNodeName As String = "") As XmlDocument Dim ser As New XmlSerializer(ObjInput.GetType, New XmlRootAttribute(ParentNodeName)) Dim xd As XmlDocument = Nothing Using memStm As New MemoryStream() ser.Serialize(memStm, ObjInput) memStm.Position = 0 Dim settings As New XmlReaderSettings() settings.IgnoreWhitespace = True Using xtr = XmlReader.Create(memStm, settings) xd = New XmlDocument() xd.Load(xtr) End Using End Using Return xd End Function
And if you have some vb.net code to serilize expandoobject or dynamicobject to XML, please feel free to share as I think the only solution for this is to handle each type differently.




Reply With Quote