Imports System.IO

Public Class Person
    Public Name As String
    Public Age As Integer
    Public Height As Integer

    Public Sub New()
    End Sub

    Public Sub New(ByVal Name As String, ByVal Age As String, _
                   ByVal Height As String)
        Me.Name = Name
        Me.Age = Age
        Me.Height = Height
    End Sub

    Public Sub SaveToFile(ByVal Filename As String)
        Dim fs As New FileStream(Filename, FileMode.Create)
        Dim w As New BinaryWriter(fs)
        w.Write(Name)
        w.Write(Age)
        w.Write(Height)

        w.Close()
    End Sub

    Public Shared Function LoadFromFile(ByVal Filename As String) As Person
        Dim fs As New FileStream(Filename, FileMode.Open)
        Dim r As New BinaryReader(fs)
        Dim NewPerson As New Person()
        NewPerson.Name = r.ReadString()
        NewPerson.Age = r.ReadInt32()
        NewPerson.Height = r.ReadInt32()
        r.Close()
        Return NewPerson
    End Function
End Class
