Export (0) Print
Expand All

Uri Constructor

.NET Framework 1.1

Initializes a new instance of the Uri class.

Overload List

Initializes a new instance of the Uri class with the specified URI.

Supported by the .NET Compact Framework.

[Visual Basic] Public Sub New(String)
[C#] public Uri(string);
[C++] public: Uri(String*);
[JScript] public function Uri(String);

Initializes a new instance of the Uri class from the specified instances of the SerializationInfo and StreamingContext classes.

[Visual Basic] Protected Sub New(SerializationInfo, StreamingContext)
[C#] protected Uri(SerializationInfo, StreamingContext);
[C++] protected: Uri(SerializationInfo*, StreamingContext);
[JScript] protected function Uri(SerializationInfo, StreamingContext);

Initializes a new instance of the Uri class with the specified URI, with explicit control of character escaping.

Supported by the .NET Compact Framework.

[Visual Basic] Public Sub New(String, Boolean)
[C#] public Uri(string, bool);
[C++] public: Uri(String*, bool);
[JScript] public function Uri(String, Boolean);

Initializes a new instance of the Uri class based on the specified base and relative URIs.

Supported by the .NET Compact Framework.

[Visual Basic] Public Sub New(Uri, String)
[C#] public Uri(Uri, string);
[C++] public: Uri(Uri*, String*);
[JScript] public function Uri(Uri, String);

Initializes a new instance of the Uri class based on the specified base and releative URIs, with control of character escaping.

Supported by the .NET Compact Framework.

[Visual Basic] Public Sub New(Uri, String, Boolean)
[C#] public Uri(Uri, string, bool);
[C++] public: Uri(Uri*, String*, bool);
[JScript] public function Uri(Uri, String, Boolean);

Example

The following example creates a new instance of the Uri class by combining the relative URIs http://www.contoso.com and Hello%20World.htm to form an absolute URI.

[Visual Basic] 
Dim baseUri As New Uri("http://www.contoso.com")
Dim myUri As New Uri(baseUri, "Hello%20World.htm", False)


[C#] 
Uri baseUri = new Uri("http://www.contoso.com");
Uri myUri = new Uri(baseUri, "Hello%20World.htm",false);
   

[C++] 
Uri* baseUri = new Uri(S"http://www.contoso.com/");
Uri* myUri = new Uri(baseUri,S"Hello%20World.htm", false);

[JScript] 
var baseUri : Uri = new Uri("http://www.contoso.com");
var myUri : Uri = new Uri(baseUri, "Hello%20World.htm",false);

See Also

Uri Class | Uri Members | System Namespace

Show:
© 2014 Microsoft