-3

Can someone please help me convert this in a String format for C# code? I am not able to understand what this line of code does and my deployment is failing because of the $ sign.

   var verifyCode = $"{PREAMBLE} {apiKey}:{timeStamp}:{ Hash(apiKey, secretKey, timeStamp)}"; 

Thank you

Ditty
  • 521
  • 7
  • 24

2 Answers2

1

To convert from string interpolation to string.Format you should move {...} from the string:

var verifyCode = string.Format("{0} {1}:{2}:{3}", 
  PREAMBLE, 
  apiKey, 
  timeStamp, 
  Hash(apiKey, secretKey, timeStamp)); 
gunr2171
  • 16,104
  • 25
  • 61
  • 88
Dmitry Bychenko
  • 180,369
  • 20
  • 160
  • 215
0

Please update your c# version, it will update when you update visual studio. $ symbol was not supported in the old version of c#.

Pahalwan
  • 11
  • 3