❔ Can't use string interpolation within {}

I'm getting the error when I'm trying to use string interpolation within curly braces{}

string uname="abcd";
string pwd ="123";
string fullData= $"{"username": "{uname}","password": "{pwd}"}";

The above code throws an error.

I can do this with 2 or more lines. But I need in single line.
Was this page helpful?