C# Uri OriginalString
Description
Uri OriginalString
gets the original URI string that
was passed to the Uri constructor.
Syntax
Uri.OriginalString
has the following syntax.
public string OriginalString { get; }
Example
The following example creates a new Uri instance from a string. It illustrates the difference between the value returned from OriginalString, which returns the string that was passed to the constructor, and from a call to ToString, which returns the canonical form of the string.
//w ww.j a v a 2s . c o m
using System;
public class MainClass{
public static void Main(String[] argv){
// Create a new Uri from a string address.
Uri uriAddress = new Uri("HTTP://www.java2s.com:80//a%20and%20b.htm");
// The following outputs "http://www.java2s.com/a and b.htm".
Console.WriteLine(uriAddress.ToString());
// The following outputs "HTTP://www.java2s.com:80//a%20and%20b.htm".
Console.WriteLine(uriAddress.OriginalString);
}
}
The code above generates the following result.