我需要使用靜態緩存中的國家/地區列表保存類。C#在可訪問變量中存儲字符串,int,字符串
的數據是建立與
string shortName //Primary Key - (IL or UK for example)
int ID //Unique - has no meaning, but needs to be saved
string longName //(Israel or United Kingdom for example)
我想將其保存在一個字典:
Dictionary<string , Dictionary<int,string>> list = new Dictionary<string, Dictionary<int,string>>();
這是我需要在類的API:
Countries.getByShortName();// I dont know what to return, I'd love some advise
Countries.getById();// I might need that
Countries.getAll();// I dont know what to return, I'd love some advise
你認爲處理這個課程的最好方法是什麼?
感謝
定義類型來保存你的數據,而不是使用的字典? –
@JeffMercado關心提供一個例子?謝謝 – SexyMF