Custom types according to the documentation
Namespace Tipos
Public Class Caractere
...
End Class
Public Class Numerico(Of T)
...
End Class
Public Class Registro
...
End Class
End Namespace
Representation of 1 record
Imports Sped.Tipos
Namespace Tipos.Bloco0
Public Class Registro0000
Inherits Registro
' Propriedades da classe
Public COD_VER As Numerico(Of Integer)
Public COD_FIN As Numerico(Of Integer)
Public DT_INI As Caractere
Public DT_FIN As Caractere
Public NOME As Caractere
Public CNPJ As Caractere
Public CPF As Caractere
Public UF As Caractere
Public IE As Caractere
Public COD_MUN As Numerico(Of Integer)
Public IM As Caractere
Public SUFRAMA As Caractere
Public IND_PERFIL As Caractere
Public IND_ATIV As Numerico(Of Integer)
' Construtor (aqui está o problema)
Public Sub New()
... validação das regras do registro ...
End Sub
End Class
End Namespace
I need to pass the properties to the class and validate at the initialization of it, so I understand that it would use this looks like this:
Initialization of registration within block 0
Imports Sped.Tipos.Registros.Bloco0
Namespace Tipos.Blocos
Public Class Bloco0
Public registro0000 as Registro0000
... outros registros aqui
Public Sub New()
registro0000 = New Registro0000 With {
.COD_VER = 1,
.COD_FIN = 1,
.DT_INI = "20000101",
.DT_FIN = "20200101"
.NOME = "Foo"
.CNPJ = "00000000000000"
.CPF = ""
.UF = "MG"
.IE = ""
.COD_MUN = 0000000
.IM = ""
.SUFRAMA = ""
.IND_PERFIL = 1
.IND_ATIV = 1
}
... outras inicializações aqui
End Sub
End Class
End Namespace
In summary, I need to be able to use the parameters I'm passing using an initialization with an anonymous object inside the constructor of my registry to validate these values, but I'm not able to understand how to process this, and until then With {}
only occurs after initialization ... How to solve?