Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27443

Serialization question

$
0
0
Currently I'm doing this:
Code:

    Public Sub Serialization(ByVal file_name As String)
        Dim sw As New StreamWriter(file_name)
        Dim x As New XmlSerializer(Me.GetType)
        x.Serialize(sw, Me)
        sw.Close()
    End Sub

inside the class to serialize itself. Then calling:
Code:

<myclass>.Serialization(<myfile.xml>)
Whenever I need to serialize it. My question is, is this good practice? Or should I place the serialization in a private sub in the form I call it in?

Viewing all articles
Browse latest Browse all 27443

Latest Images

Trending Articles



Latest Images