Create List or Dictionary

  • Thread starter Thread starter shapper
  • Start date Start date
S

shapper

Hello,

I need to create a List or a Dictionary with only to items:

Id = 1, Key = "Subscribe"

Id = 2, Key = "Unsubscribe"

Is it possible to create such a list or dictionary with only one code
line?

Thank You,

Miguel
 
Dictionary<string, int> toto = new Dictionary<int, string> { {
"Subscribe" , 1}, { "Unsubscribe", 2 } };


Vanderghast, Access MVP
 
vanderghast said:
Dictionary<string, int> toto = new Dictionary<int, string> { {
"Subscribe" , 1}, { "Unsubscribe", 2 } };


Vanderghast, Access MVP

This is probably are write mistake
Dictionary<string, int> toto = new Dictionary<int, string> { {
"Subscribe" , 1}, { "Unsubscribe", 2 } };

It should insted be written as

Dictionary said:
"Subscribe" , 1}, { "Unsubscribe", 2 } };

//Tony
 
Back
Top