What's the correct namespace and method for serialising an object to xml?


I'm trying to use an example of XML serialisation. The cose uses this namespace:

Imports System.Runtime.Serialization.Formatters.Soap

And this code:

  Dim f As New SoapFormatter
  f.Serialize(s, LessonList)

but it gives an error saying 'SoapFormatter' is not defined. Indeed, it isn't in Intellisense under the above namespace.

So what's the correct code?

P.S. I have VB 2005 Express Edition. I hope that doesn't cut me out of the action. Eeck.

Who is Participating?
bruintjeConnect With a Mentor Commented:
Hi Flying-Kiwi,

you must reference the System.Runtime.Serialization.Formatters.Soap.dll assembly,
just add a reference to the project and point to it under .NET dlls on the first tab of the Add Reference dialog

hope this helps a bit
Flying-KiwiAuthor Commented:
Thx. And today I found out about using XmlSerializer. This serialization stuff blows. What a time saver. Me = Happy Boy. Tra la la la la.
glad it works great for you,

the only place i can play with all this new stuff is EE, so my learning curve is bound to questions like yours ;-)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.