0

I am looking to create an URL rquest as http://www.google.fr?Arg1=XXX&Arg2=XXX

As V1 and V2 are variable I can do

string url = "http://google.fr?Arg1=" + V1 + "&Arg2=" + V2;

But i don't found that beautiful and beauty is important.

So I am wondering if there is any method which permit to write it this way :

string url = URlBuilder.createUrl("http://google.fr", new {
             V1 = V1,
             V2 = V2
             };

Thank you very much :)

Eliott Roynette
  • 716
  • 8
  • 21
  • 1
    Does this answer your question? [How to build a query string for a URL in C#?](https://stackoverflow.com/questions/829080/how-to-build-a-query-string-for-a-url-in-c) – Jaquez Jul 03 '20 at 14:10

1 Answers1

0

You can use $ like this:

string url = $"http://google.fr?Arg1={V1}&Arg2={V2}";

Ometz123
  • 11
  • 4