Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/378.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net 如何同步属于模块和类的属性的更新_Vb.net_Oop - Fatal编程技术网

Vb.net 如何同步属于模块和类的属性的更新

Vb.net 如何同步属于模块和类的属性的更新,vb.net,oop,Vb.net,Oop,我是vb.net的新手,所以请原谅我,如果这个问题对你们中的许多人来说听起来非常简单的话。它是关于维护包含在不同类/模块中的对象。目前,我有一个名为聚合_-SI的类。以下是聚合_SI的定义 Public Class Aggregated_SI Private _identifier As Integer Private _From_Firm As String Private _From_Account_Number As String Private _To_Account_N

我是vb.net的新手,所以请原谅我,如果这个问题对你们中的许多人来说听起来非常简单的话。它是关于维护包含在不同类/模块中的对象。目前,我有一个名为聚合_-SI的类。以下是聚合_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)
如您所见,聚合的_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是字典,其中包含聚合_SI类的_identifier属性作为其键,聚合_SI对象作为其值。现在,每个帐户都包含各种聚合的\u SIs对象,这些对象是属性结算\u指令的子集


问题是,当我修改结算指令列表中的聚合SI对象时,如何确保包含在“交付”SIs和“接收”SIs中的各种聚合SI对象同时更新?我尝试在更新聚合的结算指令时,分别更新“交付”SIs和“接收”SIs中相应的SIs,但这感觉是多余的,并且代码不容易阅读。关于如何解决这个问题有什么建议吗?谢谢

没有任何帮助,但我认为您现在处理它的方式是它需要的方式,因为聚合的对象不是相同的对象(即,您使用的是类的不同实例)。如果我理解你的类,你似乎有一个丑陋的递归关系——聚合的_-SI包含包含聚合的_-SI的帐户。祝你好运我目前的做法是,我将创建一个account对象的字典,以字符串中的account number作为键。聚合类中的帐户编号具有from_account_number和to_account_number字符串,可用于从帐户列表中选择适当的帐户对象。但是现在我仍然在为列表中的帐户和聚合列表中的帐户硬编码更新,这没有任何帮助,但是我认为您现在处理它的方式是它需要的方式,因为聚合列表不是相同的对象(即,您使用的是类的不同实例)。如果我理解你的类,你似乎有一个丑陋的递归关系——聚合的_-SI包含包含聚合的_-SI的帐户。祝你好运我目前的做法是,我将创建一个account对象的字典,以字符串中的account number作为键。聚合类中的帐户编号具有from_account_number和to_account_number字符串,可用于从帐户列表中选择适当的帐户对象。但是现在我仍然在为列表和聚合列表中的帐户硬编码更新