Home > C# > What is the difference between Uri and UriBuilder?

What is the difference between Uri and UriBuilder?

The answer for this question would be similar to the question below:

What is the difference between String and StringBuilder?

Why? because they are similar in concept. A Uri/String is immutable (read-only, if you will). A UriBuilder/StringBuilder provides a mechanish to modify the contents of a Uri/String without having to destroy and recreate a Uri/String each time (which, if done often enough, could hurt performance).

String scheme = "http";
String target = "balaji.com";
int port = 8080;
String path = sample/page1.aspx";
String query = "?query=search text";
UriBuilder u = new UriBuilder(scheme, target, port, path, query);
Advertisements
Categories: C# Tags: , , , , ,
  1. March 1, 2012 at 2:53 AM

    As a Newbie, I am constantly exploring online for articles that can help me. Thank you

  2. March 4, 2012 at 8:36 AM

    Only a smiling visitor here to share the love (:, btw outstanding design and style .

  3. March 5, 2012 at 1:13 AM

    Thanks for helping out, good information.

  4. May 13, 2012 at 1:35 PM

    Its superb as your other blog posts : D, appreciate it for putting up.

  5. May 23, 2012 at 4:34 AM

    What is the difference between Uri and UriBuilder? Code Support Very nice post. I just stumbled upon your blog and wished to say that I’ve truly enjoyed surfing around your blog posts. In any case I will be subscribing to your feed and I hope you write again soon!

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: