我是vb.net的新手,所以请原谅我,如果这个问题听起来对你们很多人来说非常重要。它是关于维护包含在不同类/模块中的对象。目前我有一个名为aggregated_SI的类。以下是aggregated_SI的定义
Public Class Aggregated_SI
Private _identifier As Integer
Private _From_Firm As String
Private _From_Account_Number As String
Private _To_Account_Number As String
Private _To_Firm As String
Private _Security_Code As String
Private _Quantity As Integer
Private _Settlement_Amount As Decimal
Private _Settlement_Ccy As String
End class
在我的模块中,我定义了一个属性:
Private settlement_Instructions as List(Of Aggregated_SI)
如您所见,Aggregated_SI具有各种属性,其中包括from_account_number和to_account_number,它们实际上是指另一个类帐户的名称。 Account类具有以下属性:
Public Class Account
Private _account_Number As String
Private _security_Holding As Dictionary(Of String, Integer)
Private _deliver_SIs As Dictionary(Of Integer, Aggregated_SI)
Private _receiving_SIs As Dictionary(Of Integer, Aggregated_SI)
End class
_deliver_SIs和_receiving_SIs是包含Aggregated_SI类的_identifier属性作为其键,而aggregated_SI对象作为其值的字典。现在,每个帐户都包含各种aggregated_SIs对象,这些对象是属性settlement_Instructions
的子集问题是,当我修改settlement_Instructions列表中的Aggregated_SI对象时,如何确保同时更新_deliver_SIs和_receiving_SIs中包含的各种aggregated_SI对象?我已经尝试单独更新_deliver_SIs和_receiving_SIs中的相应SI,因为我更新了settlement_Instructions中的aggregated_SI,但这感觉多余,并且使代码不易被读取。有关如何解决这个问题的任何建议?谢谢!