Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools

SaveSoapData - serializing an object to file in SOAP format

Total Hit ( 2620)

Rate this article:     Poor     Excellent 

 Submit Your Question/Comment about this article

Rating


 


Click here to copy the following block
' Serialize an object to file in SOAP format.
Sub SaveSoapData(ByVal path As String, ByVal o As Object)
  ' Open a file stream for output.
  Dim fs As FileStream = New FileStream(path, FileMode.Create)
  ' Create a SOAP formatter for this stream.
  Dim sf As New SoapFormatter(Nothing, _
    New StreamingContext(StreamingContextStates.File))
  ' Serialize the array to the file stream, and close the stream.
  sf.Serialize(fs, o)
  fs.Close()
End Sub


' This sample procedure tests the reusable routine above.
' Note that you also need the LoadSoapData function, linked below.

Sub TestSoapSerialization()
  ' Create a hashtable object and fill it with some data.
  Dim ht As New Hashtable()
  ht.Add("One", 1)
  ht.Add("Two", 2)
  ht.Add("Three", 3)

  ' Save the hash table to disk in SOAP format.
  SaveSoapData("c:\hashtbl.xml", ht)

  ' Reload the file contents into another HashTable object.
  Dim ht2 As Hashtable
  ht2 = CType(LoadSoapData("c:\hashtbl.xml"), Hashtable)

  ' Display values.
  Dim de As DictionaryEntry
  For Each de In ht2
    Console.WriteLine("Key=" & de.Key.ToString & "  Value=" & _
      de.Value.ToString)
  Next
End Sub


Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.