1

I need to compile a project in Visual Studio 2012, so it wont understand String Interpolation..

What would be the equivalent to:

var uri = $"{BaseUrl}{collection.ToQueryUriString()}";

using String.Format?

Thank you,

3
  • 7
    string.Format("{0}{1}", BaseUrl, collection.ToQueryUriString()) Commented Apr 27, 2016 at 1:09
  • 1
    @Rob make it an answer.... Commented Apr 27, 2016 at 1:12
  • This does not answer the question but this should be of interest: stackoverflow.com/questions/372865/path-combine-for-urls Commented Apr 27, 2016 at 1:13

1 Answer 1

1

As you said and Rob mentioned in the comment, String.Format will be the answer, it will Converts the value of objects to strings based on the formats specified and inserts them into another string.The equivalent code can be return as :

var uri=String.Format("{0}{1}", BaseUrl, collection.ToQueryUriString());

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.