'' ------------------------------------------------------------------------------
''  <auto-generated>
''    Generated by Xsd2Code++. Version 6.0.0.0. www.xsd2code.com
''    {"TargetFramework":"Net20","NameSpace":"WeitergabeHauptzollamt_002","Language":"VisualBasic","CollectionBase":"","Properties":{"PrivateFieldCustomPrefix":""},"XmlAttribute":{"Enabled":true,"GenerateOrderXmlAttributes":true},"ClassParams":{"GenerateInSeparateFilesDirectory":""},"Serialization":{"ShouldSerialize":{},"AdditionalSerializers":{},"XmlSerializerEvent":{},"XmlOutput":{"IndentChars":"Indent1Space"},"JsonOutput":{},"Enabled":true,"EnableEncoding":true},"Miscellaneous":{"CleanupCode":false}}
''  </auto-generated>
'' ------------------------------------------------------------------------------
#Disable Warning
Imports System
Imports System.Diagnostics
Imports System.Xml.Serialization
Imports System.Runtime.Serialization
Imports System.Collections
Imports System.Xml.Schema
Imports System.ComponentModel
Imports System.Xml
Imports System.IO
Imports System.Text
Imports System.Collections.Generic

Namespace WeitergabeHauptzollamt_002

    <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.4084.0"),
     System.SerializableAttribute(),
     System.Diagnostics.DebuggerStepThroughAttribute(),
     System.ComponentModel.DesignerCategoryAttribute("code"),
     System.Xml.Serialization.XmlRootAttribute("WeitergabeHauptzollamt", [Namespace]:="", IsNullable:=False)>
    Partial Public Class WeiterleitungTRATyp
        Inherits DatenaustauschFreierVerkehrTyp

#Region "Private fields"
        Private _einzelWeiterleitung As EinzelWeiterleitungTyp

        Private Shared _serializerXml As XmlSerializer
#End Region

        Public Sub New()
            MyBase.New
            Me._einzelWeiterleitung = New EinzelWeiterleitungTyp()
        End Sub

        <System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=0)>
        Public Property EinzelWeiterleitung() As EinzelWeiterleitungTyp
            Get
                Return Me._einzelWeiterleitung
            End Get
            Set
                Me._einzelWeiterleitung = Value
            End Set
        End Property

        Private Shared ReadOnly Property SerializerXml() As XmlSerializer
            Get
                If (_serializerXml Is Nothing) Then
                    _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(WeiterleitungTRATyp))
                End If
                Return _serializerXml
            End Get
        End Property

#Region "Serialize/Deserialize"
        ''' <summary>
        ''' Serialize WeiterleitungTRATyp object
        ''' </summary>
        ''' <returns>XML value</returns>
        Public Overridable Overloads Function Serialize(ByVal encoding As System.Text.Encoding) As String
            Dim streamReader As System.IO.StreamReader = Nothing
            Dim memoryStream As System.IO.MemoryStream = Nothing
            Try
                memoryStream = New System.IO.MemoryStream()
                Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings()
                xmlWriterSettings.Encoding = encoding
                Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings)
                SerializerXml.Serialize(xmlWriter, Me)
                memoryStream.Seek(0, SeekOrigin.Begin)
                streamReader = New System.IO.StreamReader(memoryStream, encoding)
                Return streamReader.ReadToEnd
            Finally
                If (Not (streamReader) Is Nothing) Then
                    streamReader.Dispose()
                End If
                If (Not (memoryStream) Is Nothing) Then
                    memoryStream.Dispose()
                End If
            End Try
        End Function

        Public Overridable Overloads Function Serialize() As String
            Return Serialize(System.Text.Encoding.UTF8)
        End Function

        ''' <summary>
        ''' Deserializes WeiterleitungTRATyp object
        ''' </summary>
        ''' <param name="input">string to deserialize</param>
        ''' <param name="obj">Output WeiterleitungTRATyp object</param>
        ''' <param name="exception">output Exception value if deserialize failed</param>
        ''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
        Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As WeiterleitungTRATyp, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            obj = CType(Nothing, WeiterleitungTRATyp)
            Try
                obj = Deserialize(input)
                Return True
            Catch ex As System.Exception
                exception = ex
                Return False
            End Try
        End Function

        Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As WeiterleitungTRATyp) As Boolean
            Dim exception As System.Exception = Nothing
            Return Deserialize(input, obj, exception)
        End Function

        Public Overloads Shared Function Deserialize(ByVal input As String) As WeiterleitungTRATyp
            Dim stringReader As System.IO.StringReader = Nothing
            Try
                stringReader = New System.IO.StringReader(input)
                Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), WeiterleitungTRATyp)
            Finally
                If (Not (stringReader) Is Nothing) Then
                    stringReader.Dispose()
                End If
            End Try
        End Function

        Public Overloads Shared Function Deserialize(ByVal s As System.IO.Stream) As WeiterleitungTRATyp
            Return CType(SerializerXml.Deserialize(s), WeiterleitungTRATyp)
        End Function
#End Region

        ''' <summary>
        ''' Serializes current WeiterleitungTRATyp object into file
        ''' </summary>
        ''' <param name="fileName">full path of outupt xml file</param>
        ''' <param name="exception">output Exception value if failed</param>
        ''' <returns>true if can serialize and save into file; otherwise, false</returns>
        Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            Try
                SaveToFile(fileName, encoding)
                Return True
            Catch e As System.Exception
                exception = e
                Return False
            End Try
        End Function

        Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
            Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception)
        End Function

        Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
            SaveToFile(fileName, System.Text.Encoding.UTF8)
        End Sub

        Public Overridable Overloads Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding)
            Dim streamWriter As System.IO.StreamWriter = Nothing
            Try
                Dim dataString As String = Serialize(encoding)
                streamWriter = New System.IO.StreamWriter(fileName, False, encoding)
                streamWriter.WriteLine(dataString)
                streamWriter.Close()
            Finally
                If (Not (streamWriter) Is Nothing) Then
                    streamWriter.Dispose()
                End If
            End Try
        End Sub

        ''' <summary>
        ''' Deserializes xml markup from file into an WeiterleitungTRATyp object
        ''' </summary>
        ''' <param name="fileName">File to load and deserialize</param>
        ''' <param name="obj">Output WeiterleitungTRATyp object</param>
        ''' <param name="exception">output Exception value if deserialize failed</param>
        ''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
        Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef obj As WeiterleitungTRATyp, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            obj = CType(Nothing, WeiterleitungTRATyp)
            Try
                obj = LoadFromFile(fileName, encoding)
                Return True
            Catch ex As System.Exception
                exception = ex
                Return False
            End Try
        End Function

        Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As WeiterleitungTRATyp, ByRef exception As System.Exception) As Boolean
            Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception)
        End Function

        Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As WeiterleitungTRATyp) As Boolean
            Dim exception As System.Exception = Nothing
            Return LoadFromFile(fileName, obj, exception)
        End Function

        Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As WeiterleitungTRATyp
            Return LoadFromFile(fileName, System.Text.Encoding.UTF8)
        End Function

        Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As WeiterleitungTRATyp
            Dim file As System.IO.FileStream = Nothing
            Dim sr As System.IO.StreamReader = Nothing
            Try
                file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
                sr = New System.IO.StreamReader(file, encoding)
                Dim dataString As String = sr.ReadToEnd
                sr.Close()
                file.Close()
                Return Deserialize(dataString)
            Finally
                If (Not (file) Is Nothing) Then
                    file.Dispose()
                End If
                If (Not (sr) Is Nothing) Then
                    sr.Dispose()
                End If
            End Try
        End Function
    End Class

    <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.4084.0"),
     System.SerializableAttribute(),
     System.Diagnostics.DebuggerStepThroughAttribute(),
     System.ComponentModel.DesignerCategoryAttribute("code")>
    Partial Public Class EinzelWeiterleitungTyp

#Region "Private fields"
        Private _objektIdentifizierung As ObjektIdentifizierungTRATyp

        Private _kopfDaten As KopfDatenWeiterleitungTyp

        Private Shared _serializerXml As XmlSerializer
#End Region

        Public Sub New()
            MyBase.New
            Me._kopfDaten = New KopfDatenWeiterleitungTyp()
            Me._objektIdentifizierung = New ObjektIdentifizierungTRATyp()
        End Sub

        <System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=0)>
        Public Property ObjektIdentifizierung() As ObjektIdentifizierungTRATyp
            Get
                Return Me._objektIdentifizierung
            End Get
            Set
                Me._objektIdentifizierung = Value
            End Set
        End Property

        <System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=1)>
        Public Property KopfDaten() As KopfDatenWeiterleitungTyp
            Get
                Return Me._kopfDaten
            End Get
            Set
                Me._kopfDaten = Value
            End Set
        End Property

        Private Shared ReadOnly Property SerializerXml() As XmlSerializer
            Get
                If (_serializerXml Is Nothing) Then
                    _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(EinzelWeiterleitungTyp))
                End If
                Return _serializerXml
            End Get
        End Property

#Region "Serialize/Deserialize"
        ''' <summary>
        ''' Serialize EinzelWeiterleitungTyp object
        ''' </summary>
        ''' <returns>XML value</returns>
        Public Overridable Overloads Function Serialize(ByVal encoding As System.Text.Encoding) As String
            Dim streamReader As System.IO.StreamReader = Nothing
            Dim memoryStream As System.IO.MemoryStream = Nothing
            Try
                memoryStream = New System.IO.MemoryStream()
                Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings()
                xmlWriterSettings.Encoding = encoding
                Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings)
                SerializerXml.Serialize(xmlWriter, Me)
                memoryStream.Seek(0, SeekOrigin.Begin)
                streamReader = New System.IO.StreamReader(memoryStream, encoding)
                Return streamReader.ReadToEnd
            Finally
                If (Not (streamReader) Is Nothing) Then
                    streamReader.Dispose()
                End If
                If (Not (memoryStream) Is Nothing) Then
                    memoryStream.Dispose()
                End If
            End Try
        End Function

        Public Overridable Overloads Function Serialize() As String
            Return Serialize(System.Text.Encoding.UTF8)
        End Function

        ''' <summary>
        ''' Deserializes EinzelWeiterleitungTyp object
        ''' </summary>
        ''' <param name="input">string to deserialize</param>
        ''' <param name="obj">Output EinzelWeiterleitungTyp object</param>
        ''' <param name="exception">output Exception value if deserialize failed</param>
        ''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
        Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As EinzelWeiterleitungTyp, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            obj = CType(Nothing, EinzelWeiterleitungTyp)
            Try
                obj = Deserialize(input)
                Return True
            Catch ex As System.Exception
                exception = ex
                Return False
            End Try
        End Function

        Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As EinzelWeiterleitungTyp) As Boolean
            Dim exception As System.Exception = Nothing
            Return Deserialize(input, obj, exception)
        End Function

        Public Overloads Shared Function Deserialize(ByVal input As String) As EinzelWeiterleitungTyp
            Dim stringReader As System.IO.StringReader = Nothing
            Try
                stringReader = New System.IO.StringReader(input)
                Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), EinzelWeiterleitungTyp)
            Finally
                If (Not (stringReader) Is Nothing) Then
                    stringReader.Dispose()
                End If
            End Try
        End Function

        Public Overloads Shared Function Deserialize(ByVal s As System.IO.Stream) As EinzelWeiterleitungTyp
            Return CType(SerializerXml.Deserialize(s), EinzelWeiterleitungTyp)
        End Function
#End Region

        ''' <summary>
        ''' Serializes current EinzelWeiterleitungTyp object into file
        ''' </summary>
        ''' <param name="fileName">full path of outupt xml file</param>
        ''' <param name="exception">output Exception value if failed</param>
        ''' <returns>true if can serialize and save into file; otherwise, false</returns>
        Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            Try
                SaveToFile(fileName, encoding)
                Return True
            Catch e As System.Exception
                exception = e
                Return False
            End Try
        End Function

        Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
            Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception)
        End Function

        Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
            SaveToFile(fileName, System.Text.Encoding.UTF8)
        End Sub

        Public Overridable Overloads Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding)
            Dim streamWriter As System.IO.StreamWriter = Nothing
            Try
                Dim dataString As String = Serialize(encoding)
                streamWriter = New System.IO.StreamWriter(fileName, False, encoding)
                streamWriter.WriteLine(dataString)
                streamWriter.Close()
            Finally
                If (Not (streamWriter) Is Nothing) Then
                    streamWriter.Dispose()
                End If
            End Try
        End Sub

        ''' <summary>
        ''' Deserializes xml markup from file into an EinzelWeiterleitungTyp object
        ''' </summary>
        ''' <param name="fileName">File to load and deserialize</param>
        ''' <param name="obj">Output EinzelWeiterleitungTyp object</param>
        ''' <param name="exception">output Exception value if deserialize failed</param>
        ''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
        Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef obj As EinzelWeiterleitungTyp, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            obj = CType(Nothing, EinzelWeiterleitungTyp)
            Try
                obj = LoadFromFile(fileName, encoding)
                Return True
            Catch ex As System.Exception
                exception = ex
                Return False
            End Try
        End Function

        Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As EinzelWeiterleitungTyp, ByRef exception As System.Exception) As Boolean
            Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception)
        End Function

        Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As EinzelWeiterleitungTyp) As Boolean
            Dim exception As System.Exception = Nothing
            Return LoadFromFile(fileName, obj, exception)
        End Function

        Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As EinzelWeiterleitungTyp
            Return LoadFromFile(fileName, System.Text.Encoding.UTF8)
        End Function

        Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As EinzelWeiterleitungTyp
            Dim file As System.IO.FileStream = Nothing
            Dim sr As System.IO.StreamReader = Nothing
            Try
                file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
                sr = New System.IO.StreamReader(file, encoding)
                Dim dataString As String = sr.ReadToEnd
                sr.Close()
                file.Close()
                Return Deserialize(dataString)
            Finally
                If (Not (file) Is Nothing) Then
                    file.Dispose()
                End If
                If (Not (sr) Is Nothing) Then
                    sr.Dispose()
                End If
            End Try
        End Function
    End Class

    <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.4084.0"),
     System.SerializableAttribute(),
     System.Diagnostics.DebuggerStepThroughAttribute(),
     System.ComponentModel.DesignerCategoryAttribute("code")>
    Partial Public Class ObjektIdentifizierungTRATyp

#Region "Private fields"
        Private _objektName As String

        Private _objektAlias As String

        Private _eDIFACTNachrichtenNr As String

        Private _zeitpunktEingang As Date

        Private _shipmentReferenz As String

        Private Shared _serializerXml As XmlSerializer
#End Region

        <System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=0)>
        Public Property ObjektName() As String
            Get
                Return Me._objektName
            End Get
            Set
                Me._objektName = Value
            End Set
        End Property

        <System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=1)>
        Public Property ObjektAlias() As String
            Get
                Return Me._objektAlias
            End Get
            Set
                Me._objektAlias = Value
            End Set
        End Property

        <System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=2)>
        Public Property EDIFACTNachrichtenNr() As String
            Get
                Return Me._eDIFACTNachrichtenNr
            End Get
            Set
                Me._eDIFACTNachrichtenNr = Value
            End Set
        End Property

        <System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=3)>
        Public Property ZeitpunktEingang() As Date
            Get
                Return Me._zeitpunktEingang
            End Get
            Set
                Me._zeitpunktEingang = Value
            End Set
        End Property

        <System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=4)>
        Public Property ShipmentReferenz() As String
            Get
                Return Me._shipmentReferenz
            End Get
            Set
                Me._shipmentReferenz = Value
            End Set
        End Property

        Private Shared ReadOnly Property SerializerXml() As XmlSerializer
            Get
                If (_serializerXml Is Nothing) Then
                    _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(ObjektIdentifizierungTRATyp))
                End If
                Return _serializerXml
            End Get
        End Property

#Region "Serialize/Deserialize"
        ''' <summary>
        ''' Serialize ObjektIdentifizierungTRATyp object
        ''' </summary>
        ''' <returns>XML value</returns>
        Public Overridable Overloads Function Serialize(ByVal encoding As System.Text.Encoding) As String
            Dim streamReader As System.IO.StreamReader = Nothing
            Dim memoryStream As System.IO.MemoryStream = Nothing
            Try
                memoryStream = New System.IO.MemoryStream()
                Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings()
                xmlWriterSettings.Encoding = encoding
                Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings)
                SerializerXml.Serialize(xmlWriter, Me)
                memoryStream.Seek(0, SeekOrigin.Begin)
                streamReader = New System.IO.StreamReader(memoryStream, encoding)
                Return streamReader.ReadToEnd
            Finally
                If (Not (streamReader) Is Nothing) Then
                    streamReader.Dispose()
                End If
                If (Not (memoryStream) Is Nothing) Then
                    memoryStream.Dispose()
                End If
            End Try
        End Function

        Public Overridable Overloads Function Serialize() As String
            Return Serialize(System.Text.Encoding.UTF8)
        End Function

        ''' <summary>
        ''' Deserializes ObjektIdentifizierungTRATyp object
        ''' </summary>
        ''' <param name="input">string to deserialize</param>
        ''' <param name="obj">Output ObjektIdentifizierungTRATyp object</param>
        ''' <param name="exception">output Exception value if deserialize failed</param>
        ''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
        Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As ObjektIdentifizierungTRATyp, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            obj = CType(Nothing, ObjektIdentifizierungTRATyp)
            Try
                obj = Deserialize(input)
                Return True
            Catch ex As System.Exception
                exception = ex
                Return False
            End Try
        End Function

        Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As ObjektIdentifizierungTRATyp) As Boolean
            Dim exception As System.Exception = Nothing
            Return Deserialize(input, obj, exception)
        End Function

        Public Overloads Shared Function Deserialize(ByVal input As String) As ObjektIdentifizierungTRATyp
            Dim stringReader As System.IO.StringReader = Nothing
            Try
                stringReader = New System.IO.StringReader(input)
                Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), ObjektIdentifizierungTRATyp)
            Finally
                If (Not (stringReader) Is Nothing) Then
                    stringReader.Dispose()
                End If
            End Try
        End Function

        Public Overloads Shared Function Deserialize(ByVal s As System.IO.Stream) As ObjektIdentifizierungTRATyp
            Return CType(SerializerXml.Deserialize(s), ObjektIdentifizierungTRATyp)
        End Function
#End Region

        ''' <summary>
        ''' Serializes current ObjektIdentifizierungTRATyp object into file
        ''' </summary>
        ''' <param name="fileName">full path of outupt xml file</param>
        ''' <param name="exception">output Exception value if failed</param>
        ''' <returns>true if can serialize and save into file; otherwise, false</returns>
        Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            Try
                SaveToFile(fileName, encoding)
                Return True
            Catch e As System.Exception
                exception = e
                Return False
            End Try
        End Function

        Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
            Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception)
        End Function

        Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
            SaveToFile(fileName, System.Text.Encoding.UTF8)
        End Sub

        Public Overridable Overloads Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding)
            Dim streamWriter As System.IO.StreamWriter = Nothing
            Try
                Dim dataString As String = Serialize(encoding)
                streamWriter = New System.IO.StreamWriter(fileName, False, encoding)
                streamWriter.WriteLine(dataString)
                streamWriter.Close()
            Finally
                If (Not (streamWriter) Is Nothing) Then
                    streamWriter.Dispose()
                End If
            End Try
        End Sub

        ''' <summary>
        ''' Deserializes xml markup from file into an ObjektIdentifizierungTRATyp object
        ''' </summary>
        ''' <param name="fileName">File to load and deserialize</param>
        ''' <param name="obj">Output ObjektIdentifizierungTRATyp object</param>
        ''' <param name="exception">output Exception value if deserialize failed</param>
        ''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
        Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef obj As ObjektIdentifizierungTRATyp, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            obj = CType(Nothing, ObjektIdentifizierungTRATyp)
            Try
                obj = LoadFromFile(fileName, encoding)
                Return True
            Catch ex As System.Exception
                exception = ex
                Return False
            End Try
        End Function

        Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As ObjektIdentifizierungTRATyp, ByRef exception As System.Exception) As Boolean
            Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception)
        End Function

        Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As ObjektIdentifizierungTRATyp) As Boolean
            Dim exception As System.Exception = Nothing
            Return LoadFromFile(fileName, obj, exception)
        End Function

        Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As ObjektIdentifizierungTRATyp
            Return LoadFromFile(fileName, System.Text.Encoding.UTF8)
        End Function

        Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As ObjektIdentifizierungTRATyp
            Dim file As System.IO.FileStream = Nothing
            Dim sr As System.IO.StreamReader = Nothing
            Try
                file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
                sr = New System.IO.StreamReader(file, encoding)
                Dim dataString As String = sr.ReadToEnd
                sr.Close()
                file.Close()
                Return Deserialize(dataString)
            Finally
                If (Not (file) Is Nothing) Then
                    file.Dispose()
                End If
                If (Not (sr) Is Nothing) Then
                    sr.Dispose()
                End If
            End Try
        End Function
    End Class

    <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.4084.0"),
     System.SerializableAttribute(),
     System.Diagnostics.DebuggerStepThroughAttribute(),
     System.ComponentModel.DesignerCategoryAttribute("code")>
    Partial Public Class KopfDatenWeiterleitungTyp

#Region "Private fields"
        Private _zollBearbeiter As String

        Private _weiterleitungBegruendung As String

        Private _weitergeleiteteZollanmeldungRegistrierNr As String

        Private _weiterleitungDatum As Date

        Private _dienststellenschluessel As String

        Private _hZABezeichnung As String

        Private _hZAOrtS As String

        Private _hZAPLZS As String

        Private _hZAStrasseHausNr As String

        Private _hZAOrtP As String

        Private _hZAPLZP As String

        Private _hZAPostfach As String

        Private Shared _serializerXml As XmlSerializer
#End Region

        <System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=0)>
        Public Property ZollBearbeiter() As String
            Get
                Return Me._zollBearbeiter
            End Get
            Set
                Me._zollBearbeiter = Value
            End Set
        End Property

        <System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=1)>
        Public Property WeiterleitungBegruendung() As String
            Get
                Return Me._weiterleitungBegruendung
            End Get
            Set
                Me._weiterleitungBegruendung = Value
            End Set
        End Property

        <System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=2)>
        Public Property WeitergeleiteteZollanmeldungRegistrierNr() As String
            Get
                Return Me._weitergeleiteteZollanmeldungRegistrierNr
            End Get
            Set
                Me._weitergeleiteteZollanmeldungRegistrierNr = Value
            End Set
        End Property

        <System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType:="date", Order:=3)>
        Public Property WeiterleitungDatum() As Date
            Get
                Return Me._weiterleitungDatum
            End Get
            Set
                Me._weiterleitungDatum = Value
            End Set
        End Property

        <System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType:="nonNegativeInteger", Order:=4)>
        Public Property Dienststellenschluessel() As String
            Get
                Return Me._dienststellenschluessel
            End Get
            Set
                Me._dienststellenschluessel = Value
            End Set
        End Property

        <System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=5)>
        Public Property HZABezeichnung() As String
            Get
                Return Me._hZABezeichnung
            End Get
            Set
                Me._hZABezeichnung = Value
            End Set
        End Property

        <System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=6)>
        Public Property HZAOrtS() As String
            Get
                Return Me._hZAOrtS
            End Get
            Set
                Me._hZAOrtS = Value
            End Set
        End Property

        <System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=7)>
        Public Property HZAPLZS() As String
            Get
                Return Me._hZAPLZS
            End Get
            Set
                Me._hZAPLZS = Value
            End Set
        End Property

        <System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=8)>
        Public Property HZAStrasseHausNr() As String
            Get
                Return Me._hZAStrasseHausNr
            End Get
            Set
                Me._hZAStrasseHausNr = Value
            End Set
        End Property

        <System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=9)>
        Public Property HZAOrtP() As String
            Get
                Return Me._hZAOrtP
            End Get
            Set
                Me._hZAOrtP = Value
            End Set
        End Property

        <System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=10)>
        Public Property HZAPLZP() As String
            Get
                Return Me._hZAPLZP
            End Get
            Set
                Me._hZAPLZP = Value
            End Set
        End Property

        <System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=11)>
        Public Property HZAPostfach() As String
            Get
                Return Me._hZAPostfach
            End Get
            Set
                Me._hZAPostfach = Value
            End Set
        End Property

        Private Shared ReadOnly Property SerializerXml() As XmlSerializer
            Get
                If (_serializerXml Is Nothing) Then
                    _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(KopfDatenWeiterleitungTyp))
                End If
                Return _serializerXml
            End Get
        End Property

#Region "Serialize/Deserialize"
        ''' <summary>
        ''' Serialize KopfDatenWeiterleitungTyp object
        ''' </summary>
        ''' <returns>XML value</returns>
        Public Overridable Overloads Function Serialize(ByVal encoding As System.Text.Encoding) As String
            Dim streamReader As System.IO.StreamReader = Nothing
            Dim memoryStream As System.IO.MemoryStream = Nothing
            Try
                memoryStream = New System.IO.MemoryStream()
                Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings()
                xmlWriterSettings.Encoding = encoding
                Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings)
                SerializerXml.Serialize(xmlWriter, Me)
                memoryStream.Seek(0, SeekOrigin.Begin)
                streamReader = New System.IO.StreamReader(memoryStream, encoding)
                Return streamReader.ReadToEnd
            Finally
                If (Not (streamReader) Is Nothing) Then
                    streamReader.Dispose()
                End If
                If (Not (memoryStream) Is Nothing) Then
                    memoryStream.Dispose()
                End If
            End Try
        End Function

        Public Overridable Overloads Function Serialize() As String
            Return Serialize(System.Text.Encoding.UTF8)
        End Function

        ''' <summary>
        ''' Deserializes KopfDatenWeiterleitungTyp object
        ''' </summary>
        ''' <param name="input">string to deserialize</param>
        ''' <param name="obj">Output KopfDatenWeiterleitungTyp object</param>
        ''' <param name="exception">output Exception value if deserialize failed</param>
        ''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
        Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As KopfDatenWeiterleitungTyp, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            obj = CType(Nothing, KopfDatenWeiterleitungTyp)
            Try
                obj = Deserialize(input)
                Return True
            Catch ex As System.Exception
                exception = ex
                Return False
            End Try
        End Function

        Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As KopfDatenWeiterleitungTyp) As Boolean
            Dim exception As System.Exception = Nothing
            Return Deserialize(input, obj, exception)
        End Function

        Public Overloads Shared Function Deserialize(ByVal input As String) As KopfDatenWeiterleitungTyp
            Dim stringReader As System.IO.StringReader = Nothing
            Try
                stringReader = New System.IO.StringReader(input)
                Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), KopfDatenWeiterleitungTyp)
            Finally
                If (Not (stringReader) Is Nothing) Then
                    stringReader.Dispose()
                End If
            End Try
        End Function

        Public Overloads Shared Function Deserialize(ByVal s As System.IO.Stream) As KopfDatenWeiterleitungTyp
            Return CType(SerializerXml.Deserialize(s), KopfDatenWeiterleitungTyp)
        End Function
#End Region

        ''' <summary>
        ''' Serializes current KopfDatenWeiterleitungTyp object into file
        ''' </summary>
        ''' <param name="fileName">full path of outupt xml file</param>
        ''' <param name="exception">output Exception value if failed</param>
        ''' <returns>true if can serialize and save into file; otherwise, false</returns>
        Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            Try
                SaveToFile(fileName, encoding)
                Return True
            Catch e As System.Exception
                exception = e
                Return False
            End Try
        End Function

        Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
            Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception)
        End Function

        Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
            SaveToFile(fileName, System.Text.Encoding.UTF8)
        End Sub

        Public Overridable Overloads Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding)
            Dim streamWriter As System.IO.StreamWriter = Nothing
            Try
                Dim dataString As String = Serialize(encoding)
                streamWriter = New System.IO.StreamWriter(fileName, False, encoding)
                streamWriter.WriteLine(dataString)
                streamWriter.Close()
            Finally
                If (Not (streamWriter) Is Nothing) Then
                    streamWriter.Dispose()
                End If
            End Try
        End Sub

        ''' <summary>
        ''' Deserializes xml markup from file into an KopfDatenWeiterleitungTyp object
        ''' </summary>
        ''' <param name="fileName">File to load and deserialize</param>
        ''' <param name="obj">Output KopfDatenWeiterleitungTyp object</param>
        ''' <param name="exception">output Exception value if deserialize failed</param>
        ''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
        Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef obj As KopfDatenWeiterleitungTyp, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            obj = CType(Nothing, KopfDatenWeiterleitungTyp)
            Try
                obj = LoadFromFile(fileName, encoding)
                Return True
            Catch ex As System.Exception
                exception = ex
                Return False
            End Try
        End Function

        Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As KopfDatenWeiterleitungTyp, ByRef exception As System.Exception) As Boolean
            Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception)
        End Function

        Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As KopfDatenWeiterleitungTyp) As Boolean
            Dim exception As System.Exception = Nothing
            Return LoadFromFile(fileName, obj, exception)
        End Function

        Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As KopfDatenWeiterleitungTyp
            Return LoadFromFile(fileName, System.Text.Encoding.UTF8)
        End Function

        Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As KopfDatenWeiterleitungTyp
            Dim file As System.IO.FileStream = Nothing
            Dim sr As System.IO.StreamReader = Nothing
            Try
                file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
                sr = New System.IO.StreamReader(file, encoding)
                Dim dataString As String = sr.ReadToEnd
                sr.Close()
                file.Close()
                Return Deserialize(dataString)
            Finally
                If (Not (file) Is Nothing) Then
                    file.Dispose()
                End If
                If (Not (sr) Is Nothing) Then
                    sr.Dispose()
                End If
            End Try
        End Function
    End Class

    <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.4084.0"),
     System.SerializableAttribute(),
     System.Diagnostics.DebuggerStepThroughAttribute(),
     System.ComponentModel.DesignerCategoryAttribute("code")>
    Partial Public Class TransaktionFreierVerkehrTyp

#Region "Private fields"
        Private _iOPartner As String

        Private _iODivision1 As String

        Private _iODivision2 As String

        Private _iODivision3 As String

        Private _iOReferenz As String

        Private _iODatumZeit As Date

        Private _version As String

        Private Shared _serializerXml As XmlSerializer
#End Region

        <System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=0)>
        Public Property IOPartner() As String
            Get
                Return Me._iOPartner
            End Get
            Set
                Me._iOPartner = Value
            End Set
        End Property

        <System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=1)>
        Public Property IODivision1() As String
            Get
                Return Me._iODivision1
            End Get
            Set
                Me._iODivision1 = Value
            End Set
        End Property

        <System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=2)>
        Public Property IODivision2() As String
            Get
                Return Me._iODivision2
            End Get
            Set
                Me._iODivision2 = Value
            End Set
        End Property

        <System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=3)>
        Public Property IODivision3() As String
            Get
                Return Me._iODivision3
            End Get
            Set
                Me._iODivision3 = Value
            End Set
        End Property

        <System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=4)>
        Public Property IOReferenz() As String
            Get
                Return Me._iOReferenz
            End Get
            Set
                Me._iOReferenz = Value
            End Set
        End Property

        <System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=5)>
        Public Property IODatumZeit() As Date
            Get
                Return Me._iODatumZeit
            End Get
            Set
                Me._iODatumZeit = Value
            End Set
        End Property

        <System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType:="nonNegativeInteger", Order:=6)>
        Public Property Version() As String
            Get
                Return Me._version
            End Get
            Set
                Me._version = Value
            End Set
        End Property

        Private Shared ReadOnly Property SerializerXml() As XmlSerializer
            Get
                If (_serializerXml Is Nothing) Then
                    _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TransaktionFreierVerkehrTyp))
                End If
                Return _serializerXml
            End Get
        End Property

#Region "Serialize/Deserialize"
        ''' <summary>
        ''' Serialize TransaktionFreierVerkehrTyp object
        ''' </summary>
        ''' <returns>XML value</returns>
        Public Overridable Overloads Function Serialize(ByVal encoding As System.Text.Encoding) As String
            Dim streamReader As System.IO.StreamReader = Nothing
            Dim memoryStream As System.IO.MemoryStream = Nothing
            Try
                memoryStream = New System.IO.MemoryStream()
                Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings()
                xmlWriterSettings.Encoding = encoding
                Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings)
                SerializerXml.Serialize(xmlWriter, Me)
                memoryStream.Seek(0, SeekOrigin.Begin)
                streamReader = New System.IO.StreamReader(memoryStream, encoding)
                Return streamReader.ReadToEnd
            Finally
                If (Not (streamReader) Is Nothing) Then
                    streamReader.Dispose()
                End If
                If (Not (memoryStream) Is Nothing) Then
                    memoryStream.Dispose()
                End If
            End Try
        End Function

        Public Overridable Overloads Function Serialize() As String
            Return Serialize(System.Text.Encoding.UTF8)
        End Function

        ''' <summary>
        ''' Deserializes TransaktionFreierVerkehrTyp object
        ''' </summary>
        ''' <param name="input">string to deserialize</param>
        ''' <param name="obj">Output TransaktionFreierVerkehrTyp object</param>
        ''' <param name="exception">output Exception value if deserialize failed</param>
        ''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
        Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TransaktionFreierVerkehrTyp, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            obj = CType(Nothing, TransaktionFreierVerkehrTyp)
            Try
                obj = Deserialize(input)
                Return True
            Catch ex As System.Exception
                exception = ex
                Return False
            End Try
        End Function

        Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TransaktionFreierVerkehrTyp) As Boolean
            Dim exception As System.Exception = Nothing
            Return Deserialize(input, obj, exception)
        End Function

        Public Overloads Shared Function Deserialize(ByVal input As String) As TransaktionFreierVerkehrTyp
            Dim stringReader As System.IO.StringReader = Nothing
            Try
                stringReader = New System.IO.StringReader(input)
                Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TransaktionFreierVerkehrTyp)
            Finally
                If (Not (stringReader) Is Nothing) Then
                    stringReader.Dispose()
                End If
            End Try
        End Function

        Public Overloads Shared Function Deserialize(ByVal s As System.IO.Stream) As TransaktionFreierVerkehrTyp
            Return CType(SerializerXml.Deserialize(s), TransaktionFreierVerkehrTyp)
        End Function
#End Region

        ''' <summary>
        ''' Serializes current TransaktionFreierVerkehrTyp object into file
        ''' </summary>
        ''' <param name="fileName">full path of outupt xml file</param>
        ''' <param name="exception">output Exception value if failed</param>
        ''' <returns>true if can serialize and save into file; otherwise, false</returns>
        Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            Try
                SaveToFile(fileName, encoding)
                Return True
            Catch e As System.Exception
                exception = e
                Return False
            End Try
        End Function

        Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
            Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception)
        End Function

        Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
            SaveToFile(fileName, System.Text.Encoding.UTF8)
        End Sub

        Public Overridable Overloads Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding)
            Dim streamWriter As System.IO.StreamWriter = Nothing
            Try
                Dim dataString As String = Serialize(encoding)
                streamWriter = New System.IO.StreamWriter(fileName, False, encoding)
                streamWriter.WriteLine(dataString)
                streamWriter.Close()
            Finally
                If (Not (streamWriter) Is Nothing) Then
                    streamWriter.Dispose()
                End If
            End Try
        End Sub

        ''' <summary>
        ''' Deserializes xml markup from file into an TransaktionFreierVerkehrTyp object
        ''' </summary>
        ''' <param name="fileName">File to load and deserialize</param>
        ''' <param name="obj">Output TransaktionFreierVerkehrTyp object</param>
        ''' <param name="exception">output Exception value if deserialize failed</param>
        ''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
        Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef obj As TransaktionFreierVerkehrTyp, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            obj = CType(Nothing, TransaktionFreierVerkehrTyp)
            Try
                obj = LoadFromFile(fileName, encoding)
                Return True
            Catch ex As System.Exception
                exception = ex
                Return False
            End Try
        End Function

        Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TransaktionFreierVerkehrTyp, ByRef exception As System.Exception) As Boolean
            Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception)
        End Function

        Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TransaktionFreierVerkehrTyp) As Boolean
            Dim exception As System.Exception = Nothing
            Return LoadFromFile(fileName, obj, exception)
        End Function

        Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TransaktionFreierVerkehrTyp
            Return LoadFromFile(fileName, System.Text.Encoding.UTF8)
        End Function

        Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As TransaktionFreierVerkehrTyp
            Dim file As System.IO.FileStream = Nothing
            Dim sr As System.IO.StreamReader = Nothing
            Try
                file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
                sr = New System.IO.StreamReader(file, encoding)
                Dim dataString As String = sr.ReadToEnd
                sr.Close()
                file.Close()
                Return Deserialize(dataString)
            Finally
                If (Not (file) Is Nothing) Then
                    file.Dispose()
                End If
                If (Not (sr) Is Nothing) Then
                    sr.Dispose()
                End If
            End Try
        End Function
    End Class

    <System.Xml.Serialization.XmlIncludeAttribute(GetType(WeiterleitungTRATyp)),
     System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.4084.0"),
     System.SerializableAttribute(),
     System.Diagnostics.DebuggerStepThroughAttribute(),
     System.ComponentModel.DesignerCategoryAttribute("code")>
    Partial Public Class DatenaustauschFreierVerkehrTyp

#Region "Private fields"
        Private _transaktion As TransaktionFreierVerkehrTyp

        Private Shared _serializerXml As XmlSerializer
#End Region

        Public Sub New()
            MyBase.New
            Me._transaktion = New TransaktionFreierVerkehrTyp()
        End Sub

        <System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=0)>
        Public Property Transaktion() As TransaktionFreierVerkehrTyp
            Get
                Return Me._transaktion
            End Get
            Set
                Me._transaktion = Value
            End Set
        End Property

        Private Shared ReadOnly Property SerializerXml() As XmlSerializer
            Get
                If (_serializerXml Is Nothing) Then
                    _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(DatenaustauschFreierVerkehrTyp))
                End If
                Return _serializerXml
            End Get
        End Property

#Region "Serialize/Deserialize"
        ''' <summary>
        ''' Serialize DatenaustauschFreierVerkehrTyp object
        ''' </summary>
        ''' <returns>XML value</returns>
        Public Overridable Overloads Function Serialize(ByVal encoding As System.Text.Encoding) As String
            Dim streamReader As System.IO.StreamReader = Nothing
            Dim memoryStream As System.IO.MemoryStream = Nothing
            Try
                memoryStream = New System.IO.MemoryStream()
                Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings()
                xmlWriterSettings.Encoding = encoding
                Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings)
                SerializerXml.Serialize(xmlWriter, Me)
                memoryStream.Seek(0, SeekOrigin.Begin)
                streamReader = New System.IO.StreamReader(memoryStream, encoding)
                Return streamReader.ReadToEnd
            Finally
                If (Not (streamReader) Is Nothing) Then
                    streamReader.Dispose()
                End If
                If (Not (memoryStream) Is Nothing) Then
                    memoryStream.Dispose()
                End If
            End Try
        End Function

        Public Overridable Overloads Function Serialize() As String
            Return Serialize(System.Text.Encoding.UTF8)
        End Function

        ''' <summary>
        ''' Deserializes DatenaustauschFreierVerkehrTyp object
        ''' </summary>
        ''' <param name="input">string to deserialize</param>
        ''' <param name="obj">Output DatenaustauschFreierVerkehrTyp object</param>
        ''' <param name="exception">output Exception value if deserialize failed</param>
        ''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
        Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As DatenaustauschFreierVerkehrTyp, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            obj = CType(Nothing, DatenaustauschFreierVerkehrTyp)
            Try
                obj = Deserialize(input)
                Return True
            Catch ex As System.Exception
                exception = ex
                Return False
            End Try
        End Function

        Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As DatenaustauschFreierVerkehrTyp) As Boolean
            Dim exception As System.Exception = Nothing
            Return Deserialize(input, obj, exception)
        End Function

        Public Overloads Shared Function Deserialize(ByVal input As String) As DatenaustauschFreierVerkehrTyp
            Dim stringReader As System.IO.StringReader = Nothing
            Try
                stringReader = New System.IO.StringReader(input)
                Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), DatenaustauschFreierVerkehrTyp)
            Finally
                If (Not (stringReader) Is Nothing) Then
                    stringReader.Dispose()
                End If
            End Try
        End Function

        Public Overloads Shared Function Deserialize(ByVal s As System.IO.Stream) As DatenaustauschFreierVerkehrTyp
            Return CType(SerializerXml.Deserialize(s), DatenaustauschFreierVerkehrTyp)
        End Function
#End Region

        ''' <summary>
        ''' Serializes current DatenaustauschFreierVerkehrTyp object into file
        ''' </summary>
        ''' <param name="fileName">full path of outupt xml file</param>
        ''' <param name="exception">output Exception value if failed</param>
        ''' <returns>true if can serialize and save into file; otherwise, false</returns>
        Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            Try
                SaveToFile(fileName, encoding)
                Return True
            Catch e As System.Exception
                exception = e
                Return False
            End Try
        End Function

        Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
            Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception)
        End Function

        Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
            SaveToFile(fileName, System.Text.Encoding.UTF8)
        End Sub

        Public Overridable Overloads Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding)
            Dim streamWriter As System.IO.StreamWriter = Nothing
            Try
                Dim dataString As String = Serialize(encoding)
                streamWriter = New System.IO.StreamWriter(fileName, False, encoding)
                streamWriter.WriteLine(dataString)
                streamWriter.Close()
            Finally
                If (Not (streamWriter) Is Nothing) Then
                    streamWriter.Dispose()
                End If
            End Try
        End Sub

        ''' <summary>
        ''' Deserializes xml markup from file into an DatenaustauschFreierVerkehrTyp object
        ''' </summary>
        ''' <param name="fileName">File to load and deserialize</param>
        ''' <param name="obj">Output DatenaustauschFreierVerkehrTyp object</param>
        ''' <param name="exception">output Exception value if deserialize failed</param>
        ''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
        Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef obj As DatenaustauschFreierVerkehrTyp, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            obj = CType(Nothing, DatenaustauschFreierVerkehrTyp)
            Try
                obj = LoadFromFile(fileName, encoding)
                Return True
            Catch ex As System.Exception
                exception = ex
                Return False
            End Try
        End Function

        Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As DatenaustauschFreierVerkehrTyp, ByRef exception As System.Exception) As Boolean
            Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception)
        End Function

        Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As DatenaustauschFreierVerkehrTyp) As Boolean
            Dim exception As System.Exception = Nothing
            Return LoadFromFile(fileName, obj, exception)
        End Function

        Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As DatenaustauschFreierVerkehrTyp
            Return LoadFromFile(fileName, System.Text.Encoding.UTF8)
        End Function

        Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As DatenaustauschFreierVerkehrTyp
            Dim file As System.IO.FileStream = Nothing
            Dim sr As System.IO.StreamReader = Nothing
            Try
                file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
                sr = New System.IO.StreamReader(file, encoding)
                Dim dataString As String = sr.ReadToEnd
                sr.Close()
                file.Close()
                Return Deserialize(dataString)
            Finally
                If (Not (file) Is Nothing) Then
                    file.Dispose()
                End If
                If (Not (sr) Is Nothing) Then
                    sr.Dispose()
                End If
            End Try
        End Function
    End Class
End Namespace
#Enable Warning
