Simple SttrgDictionary Collection

  • Thread starter Thread starter Namshub
  • Start date Start date
N

Namshub

I simply whant to create a key pair, so i'm looking at the specialisted
string dictionary collection, but haven't got a clue how to implement the
two matching values in terms of properties for a control. Can anyone post
sample code on
how to get and set values into the Collection, and how to hook up I'm
assuming it will use the default collection editor or will I have to design
my own?

Cheers

Ric
 
Declaration:

private Dictionary<String, String> dictionary = new
Dictionary<string,string>();

See if key exists and set values:

if (!dictionary.ContainsKey(fleet.CurrentTrain.TrainId))
dictionary.Add("X"."111");
else
dictionary["X"] = 222;

Iteration with foreach:

string s = "edbcxed";
foreach (KeyValuePair<string, string> keyValue in dictionary)
s += keyValue.Value;

Hope it helps.
 
Back
Top