Objective In this article, I will show how we could construct
URI in three ways.
Method # 1: Creating URI from
string I am passing string in constructor of URI class, to
create new URI.

Codeview of the above image
#region Creating URI from string
string url = "http://dhananjaykumar.net/feed/";
Uri uri = new Uri(url);
Console.WriteLine(uri.AbsoluteUri);
Console.Read();
#endregion
Output
Method
#2: New URI from Component Instance I am here taking host and
path individually and then combining them in constructor of Uri
class.

Codeview of the above image
#region Creating URI from Component Instance
string host = "http://dhananjaykumar.net";
string path = "/feed";
Uri uri1 = new Uri(host);
uri1 = new Uri(uri1, path);
Console.WriteLine(uri1.AbsoluteUri);
Console.Read();
#endregion Output
Method
#3: Creating URI using Try Pattern validation In this , I am
showing you how could we use Try Pattern method of URI class to construct an
URI.

Codeview of the above image
#region Create New URI Try Pattern Validation
string url = "http://dhananjaykumar.net/feed/";
Uri uri2;
if(Uri.TryCreate(url,UriKind.Absolute , out uri2))
{
Console.WriteLine(uri2);
}
Console.Read();
#endregion Output
You can also download the code from below link