Ho una struttura del tipo:
codice:
Public Structure Paziente
Public _Data As Date
Public _Name As String
Public _Surname As String
Public _Born As Date
Public _Height As Integer
Public _weight As Integer
Public _Sex As Char
Public _Test As ArrayList
Sub New(ByVal data As Date, ByVal Name As String, ByVal Surname As String, ByVal Born As Date, ByVal Height As Integer, _
ByVal Sex As Char, ByVal Weight As Integer, ByVal Test As ArrayList)
Me._Data = data
Me._Name = Name
Me._Surname = Surname
Me._Born = Born
Me._Height = Height
Me._weight = Weight
Me._Sex = Sex
Me._Test = Test
End Sub
End Structure
Ora l'arraylist _Test è composto da una lista di un'altra struttura del tipo:
codice:
Public Structure Test
Public _valorimVCO As Double()
Public _valorimVCH4 As Double()
Public _valoriCO As Double()
Public _valoriCH4 As Double()
Public _percOssigeno As Integer
Public _gain As Double
Public _zero As Double
Public _palteau As Double
Public _slope As Double
Public _name As String
Public _comment As String
Sub New(ByVal ValorimVCO As Double(), ByVal ValorimVCH4 As Double(), ByVal ValoriCO As Double(), ByVal ValoriCH4 As Double(), ByVal PercOssigeno As Integer, ByVal Gain As Double, ByVal Zero As Double, _
ByVal Palteau As Double, ByVal Slope As Double, ByVal Name As String, ByVal Comment As String)
Me._valorimVCO = ValorimVCO
Me._valorimVCH4 = ValorimVCH4
Me._valoriCO = ValoriCO
Me._valoriCH4 = ValoriCH4
Me._percOssigeno = PercOssigeno
Me._gain = Gain
Me._zero = Zero
Me._palteau = Palteau
Me._slope = Slope
Me._name = Name
Me._comment = Comment
End Sub
End Structure
La struttura Paziente viene poi serializzata e deserializzata al bisogno. Quando deserializzo e voglio modificare la struttura Paziente tutto ok. quando invece, dopo la deserializzazione, voglio modificare uno degli Item dell'arrayList _Test le modifiche che vado ad effettuare non vengono effettivamente salvate nella struttura Paziente.
Ovvero per inizializzare la struttura:
codice:
Dim myPaziente as Paziente
Dim myTest as Test
myPaziente = New Paziente(DateTime.Now, "Mario","Bianchi"), #01/01/1972#,180,"M"c,80,Nothing)
myPaziente._Test = New ArrayList
myTest = New Test(myValueCO, myValueCH4, myValueCOPerc, myValueCH4Perc, 30, 0, 0,0,0,"Te<st 1", "Il mio commento")
myPaziente._Test.Add(myTest)
Ora per modificare la struttura Paziente:
codice:
myPaziente._Name= "Mario"
myPaziente._Surname = "Mario"
Per modificare uno degli item dei Test faccio cosi ma mi sembra troppo laborioso:
codice:
myTest = Ctype(myPaziente._Test.Item(0),Test)
mytest._comment = "Commento cambiato"
myPaziente ._Test .RemoveAt(0)
myPaziente ._Test .Add(mytest)
Qualche idea?