skip to Main Content

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

2

Answers


  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)); 
    
    Login or Signup to reply.
  2. Please update your c# version, it will update when you update visual studio. $ symbol was not supported in the old version of c#.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search