I have 2 class in VB.net (Item Class and Tax Class). The Item class calls the Tax class in the form of an array.
See Class (Item-TaX)
Public Class Item
Public Property taxes As Tax()
Public Property code As String
End Class
Public Class Tax
Public Property taxCode As String
Public Property taxAmount As Integer
End Class
I need to add data to the 2 classes to build a JSON file
I'm doing it my way of thinking as follows:
Dim TaxProduct As New Tax
Dim Product As New Item
TaxProduct.taxCode = "01"
TaxProduct.taxAmount = 1000
Even there is going perfectly and the data is added in the class TaxProduct
Product.taxes = TaxProduct 'This line generates an error
Product.code = "10"
I thank you can help me
I hope you can explain to me how to enter the data in the class
Taxinstances for anItem? If so, consider changing from an Array to a List:Public Property taxes As New List(Of Tax)Then you can add to the List with:Product.taxes.Add(TaxProduct).