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
Ben durkin
source
to share
4 answers
Do you mean the keys of this dictionary? Then he updates.Keys.ToArray()
will provide them to you.
+3
Sami kuhmonen
source
to share
cs.Attributes = updates.Keys.ToArray();
+2
nvoigt
source
to share
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
Saverio Terracciano
source
to share
void SaveMultiple(Dictionary<string,decimal> updates)
{
ColumnSet cs=new ColumnSet();
cs.Attributes=updates.Keys.ToArray();
}
0
Suresh Kumar Veluswamy
source
to share