Hi @ankit goel ,
Since you can't change the key of an existing dictionary entry. You'll have to remove/add using a new key.
You can refer to the code below.
while (dic.ContainsKey("1")){
dic.Add("a", dic["1"]);
dic.Remove("1");
}
Best Regards.
Jiachen Li
----------
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.