我有一個對象myBook。在c上實現樹形結構#
我可以爲這種數據實現更好的結構嗎?
public class myRow{
public int ID = 0;
public int number = 0;
public String param1 = null;
public decimal param2 = null;
public string parm3 = "";
public int param4 = null;
}
public class mySubChapter{
public int ID = 0;
public string title = "";
public List<myRow> rows;
internal bool sort(){...} //sort rows by ID
}
public class myChapter{
public int ID = 0;
public string title = "";
public List<mySubChapter> subChapters;
internal bool sort(){...} //sort subChapters by ID
}
public class myBook{
public int ID = 0;
public string title = ""
public List<myChapter> chapters;
internal bool sort(){...} //sort chapters by ID
}
該數據結構的目的是什麼?你想保留整本書的文本還是隻保存圖書館目錄中的信息? – PMF
@PMF我將保存對象中的所有數據,我需要將其序列化並將其傳輸到另一個客戶端。 – eyalb