spidey
(Shivam Sahil)
1
I have a long dictionary of multiple config elements like this:
{
…
“sheetID”: “efretbryygdf23r4ty54htrbgfdv”,
“sheetName”: “testSheet”
…
}
I have declared a dictionary variable and I want to initialize that dictionary with the one as I shared above, I tried to use:
new Dictionary<string, string>() { [“key1”] = “value1”, [“key2”] = “value2” }
but it gives me an error saying expected end of line. Does anyone know the way to initialize the dictionary like this?
3 Likes
Hi @spidey
Use this to intialise dictionary
dict= New Dictionary (Of String, String)
Check this too
Regards
Nived N
Happy Automation
spidey
(Shivam Sahil)
3
Hi do you mean:
New Dictionary(Of String, String)
{
{“sheetID”, “efretbryygdf23r4ty54htrbgfdv”},
{“sheetName”, “testSheet”}
}
New Dictionary(Of String, String) From
{
{“sheetID”, “efretbryygdf23r4ty54htrbgfdv”},
{“sheetName”, “testSheet”}
}
Use this
Regards
Nived N
Happy Automation
7 Likes
spidey
(Shivam Sahil)
5
Thank you very much Nived_Nambiar!
1 Like
system
(system)
Closed
6
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.