Creating a list of double string items
Situation:
You can to create a List object to save two different string values, without using string splits or substrings.
Solution:
Use the KeyValuePair structure.
To retrieve data:
You can to create a List object to save two different string values, without using string splits or substrings.
Solution:
Use the KeyValuePair structure.
public List<KeyValuePair<string, string>> GetAllTimeZones() { List <KeyValuePair<string, string>> timeZones = new List<KeyValuePair<string, string>>(); timeZones.Add(new KeyValuePair<string, string>(string1, string2)); } return timeZones; }
To retrieve data:
foreach (KeyValuePair<string, string> currentTimeZone in GetAllTimeZones()) { ddlTimeZones.Items.Add(new ListItem(currentTimeZone.Key, currentTimeZone.Value)); }
Comments
Post a Comment