Learning Xamarin
Learning Xamarin

Reputation: 547

How to go from String Interpolation syntax to String.Format?

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,

Upvotes: 1

Views: 289

Answers (1)

sujith karivelil
sujith karivelil

Reputation: 29016

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

Upvotes: 1

Related Questions