鉴于以下。
TMyObject = class
...
end;
TStreet = class
...
public
property MyObject : TMyObject ...;
end;
TStreets = TList<TStreet>;
从阅读您的问题看来,TMyObject 只能绑定到一个 TStreet。
然后我会建议颠倒引用。
TStreet = class;
TMyObject = class
protected
FStreet : TStreet;
public
property Street : TStreet read FStreet write FStreet;
end;
TMyObjectList = TList<TMyObject>;
TStreet = class
private
// Looks through MyObjectList returning correct
function GetMyObjecty : TMyObject; reference.
public
property MyObject : TMyObject read GetMyObject;
// Reference to list that contains all instance of TMyObjectList.
property MyObjectList : TMyObjectList;
end;
TStreets = TList<TStreet>;
TMyObjectList = TList<TMyObject>;