I need to save a class with list of countries in statics for caching.
the data is built with
string shortName //Primary Key - (IL or UK for example)
int
I think you need to create your own class incapsulating all three fields and to use own Collection of It. For example:
class CountryInfo
{
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)
}
class CountryCollection : Collection
{
//Implement methods what you need
void getByShortName();// I dont know what to return, I'd love
void getById();// I might need that
void getAll();// I dont know what to return, I'd l
}
If you like quick search then to use a pair of dictionaries:
class CountryInfo
{
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)
}
class CountryCollection
{
Dictionary Ids = new Dictionary ();
Dictionary shortNames = new Dictionary ();
void Add (CountryInfo info)
{
Ids.Add (info.ID, info.longName);
shortnames.Add(info.ID, info.longName);
}
//Implement methods what you need
void getByShortName();// I dont know what to return, I'd love
void getById();// I might need that
void getAll();// I dont know what to return, I'd l
}