C # dictionary for array

I have it:

void SaveMultiple(Dictionary<string, decimal> updates)
{
ColumnSet cs = new ColumnSet();
cs.Attributes = new string[] { "att1", "att2", "add3" };
}

      

My attribute array should have all the string values ​​of the dictionary.

How can i do this?

thank

+3


source to share


4 answers


Do you mean the keys of this dictionary? Then he updates.Keys.ToArray()

will provide them to you.



+3


source


cs.Attributes = updates.Keys.ToArray();

      



+2


source


cs.Attributes = updates.Values.ToArray();

      

if you want values ​​or

cs.Attributes = updates.Keys.ToArray();

      

if you want to use keys (most likely as shown in the code snippet)

0


source


void SaveMultiple(Dictionary<string,decimal> updates) 
{
  ColumnSet cs=new ColumnSet();
  cs.Attributes=updates.Keys.ToArray();
}

      

0


source







All Articles