How to use UriBuilder() to create URI from URI parts in C#

2 Answers

0 votes
using System;

namespace ConsoleApplication_C_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            UriBuilder uri = new UriBuilder("http", "www.collectivesolver.com");

            Console.WriteLine(uri.ToString());
        }
    }
}


/*
run:
 
http://www.collectivesolver.com/

*/

 



answered Mar 11, 2017 by avibootz
0 votes
using System;

namespace ConsoleApplication_C_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            UriBuilder ub = new UriBuilder();

            ub.Host = "www.collectivesolver.com";
            ub.Path = "questions";
            ub.Scheme = "https"; 
            
            Console.WriteLine(ub.ToString());
        }
    }
}


/*
run:
 
https://www.collectivesolver.com/questions

*/

 



answered Mar 11, 2017 by avibootz

Related questions

2 answers 176 views
3 answers 216 views
216 views asked Mar 11, 2017 by avibootz
2 answers 284 views
1 answer 275 views
1 answer 243 views
...