如果我是你,我会创建两个类:
public class Cell {
...
public List<Station> Stations {
get {...}
}
protected Station AddStation() {
Station result = new Station(this);
Stations.Add(result);
return result;
}
}
public class Station {
public Station(Cell cell) {
this.cell = cell;
}
Cell cell;
public Cell Cell {get {return cell;}}
}
Run Code Online (Sandbox Code Playgroud)
拥有此结构后,您始终可以从Station对象访问Cell.