Uri Class

Definition

Provides an object representation of a uniform resource identifier (URI) and easy access to the parts of the URI.

public ref class Uri
public ref class Uri : IEquatable<Uri ^>, ISpanFormattable, System::Runtime::Serialization::ISerializable
public ref class Uri : System::Runtime::Serialization::ISerializable
public ref class Uri : ISpanFormattable, System::Runtime::Serialization::ISerializable
public ref class Uri : MarshalByRefObject, System::Runtime::Serialization::ISerializable
public class Uri
public class Uri : IEquatable<Uri>, ISpanFormattable, System.Runtime.Serialization.ISerializable
public class Uri : System.Runtime.Serialization.ISerializable
public class Uri : ISpanFormattable, System.Runtime.Serialization.ISerializable
[System.Serializable]
public class Uri : MarshalByRefObject, System.Runtime.Serialization.ISerializable
[System.Serializable]
[System.ComponentModel.TypeConverter(typeof(System.UriTypeConverter))]
public class Uri : System.Runtime.Serialization.ISerializable
type Uri = class
type Uri = class
    interface IEquatable<Uri>
    interface IFormattable
    interface ISpanFormattable
    interface ISerializable
type Uri = class
    interface ISerializable
type Uri = class
    interface ISpanFormattable
    interface IFormattable
    interface ISerializable
type Uri = class
    interface IFormattable
    interface ISpanFormattable
    interface IEquatable<Uri>
    interface ISerializable
[<System.Serializable>]
type Uri = class
    inherit MarshalByRefObject
    interface ISerializable
[<System.Serializable>]
[<System.ComponentModel.TypeConverter(typeof(System.UriTypeConverter))>]
type Uri = class
    interface ISerializable
Public Class Uri
Public Class Uri
Implements IEquatable(Of Uri), ISerializable, ISpanFormattable
Public Class Uri
Implements ISerializable
Public Class Uri
Implements ISerializable, ISpanFormattable
Public Class Uri
Inherits MarshalByRefObject
Implements ISerializable
Inheritance
Uri
Inheritance
Attributes
Implements

Examples

The following example creates an instance of the Uri class and uses it to perform a GET request with HttpClient.

Uri siteUri = new Uri("http://www.contoso.com/");

// HttpClient lifecycle management best practices:
// https://learn.microsoft.com/dotnet/fundamentals/networking/http/httpclient-guidelines#recommended-use
HttpClient client = new HttpClient();
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, siteUri);
HttpResponseMessage response = client.Send(request);
let siteUri = Uri "http://www.contoso.com/"

// HttpClient lifecycle management best practices:
// https://learn.microsoft.com/dotnet/fundamentals/networking/http/httpclient-guidelines#recommended-use
use client = new HttpClient ()
use request = new HttpRequestMessage (HttpMethod.Get, siteUri)
use response = client.Send request
Dim siteUri As New Uri("http://www.contoso.com/")

' HttpClient lifecycle management best practices:
' https://learn.microsoft.com/dotnet/fundamentals/networking/http/httpclient-guidelines#recommended-use
Dim client As New HttpClient()
Dim request As New HttpRequestMessage(HttpMethod.Get, siteUri)
Dim response As HttpResponseMessage = client.Send(request)

The following code snippet shows example values of the various properties on the class.

Uri uri = new Uri("https://user:password@www.contoso.com:80/Home/Index.htm?q1=v1&q2=v2#FragmentName");

Console.WriteLine($"AbsolutePath: {uri.AbsolutePath}");
Console.WriteLine($"AbsoluteUri: {uri.AbsoluteUri}");
Console.WriteLine($"DnsSafeHost: {uri.DnsSafeHost}");
Console.WriteLine($"Fragment: {uri.Fragment}");
Console.WriteLine($"Host: {uri.Host}");
Console.WriteLine($"HostNameType: {uri.HostNameType}");
Console.WriteLine($"IdnHost: {uri.IdnHost}");
Console.WriteLine($"IsAbsoluteUri: {uri.IsAbsoluteUri}");
Console.WriteLine($"IsDefaultPort: {uri.IsDefaultPort}");
Console.WriteLine($"IsFile: {uri.IsFile}");
Console.WriteLine($"IsLoopback: {uri.IsLoopback}");
Console.WriteLine($"IsUnc: {uri.IsUnc}");
Console.WriteLine($"LocalPath: {uri.LocalPath}");
Console.WriteLine($"OriginalString: {uri.OriginalString}");
Console.WriteLine($"PathAndQuery: {uri.PathAndQuery}");
Console.WriteLine($"Port: {uri.Port}");
Console.WriteLine($"Query: {uri.Query}");
Console.WriteLine($"Scheme: {uri.Scheme}");
Console.WriteLine($"Segments: {string.Join(", ", uri.Segments)}");
Console.WriteLine($"UserEscaped: {uri.UserEscaped}");
Console.WriteLine($"UserInfo: {uri.UserInfo}");

// AbsolutePath: /Home/Index.htm
// AbsoluteUri: https://user:password@www.contoso.com:80/Home/Index.htm?q1=v1&q2=v2#FragmentName
// DnsSafeHost: www.contoso.com
// Fragment: #FragmentName
// Host: www.contoso.com
// HostNameType: Dns
// IdnHost: www.contoso.com
// IsAbsoluteUri: True
// IsDefaultPort: False
// IsFile: False
// IsLoopback: False
// IsUnc: False
// LocalPath: /Home/Index.htm
// OriginalString: https://user:password@www.contoso.com:80/Home/Index.htm?q1=v1&q2=v2#FragmentName
// PathAndQuery: /Home/Index.htm?q1=v1&q2=v2
// Port: 80
// Query: ?q1=v1&q2=v2
// Scheme: https
// Segments: /, Home/, Index.htm
// UserEscaped: False
// UserInfo: user:password
let uri = Uri "https://user:password@www.contoso.com:80/Home/Index.htm?q1=v1&q2=v2#FragmentName"

printfn $"AbsolutePath: {uri.AbsolutePath}"
printfn $"AbsoluteUri: {uri.AbsoluteUri}"
printfn $"DnsSafeHost: {uri.DnsSafeHost}"
printfn $"Fragment: {uri.Fragment}"
printfn $"Host: {uri.Host}"
printfn $"HostNameType: {uri.HostNameType}"
printfn $"IdnHost: {uri.IdnHost}"
printfn $"IsAbsoluteUri: {uri.IsAbsoluteUri}"
printfn $"IsDefaultPort: {uri.IsDefaultPort}"
printfn $"IsFile: {uri.IsFile}"
printfn $"IsLoopback: {uri.IsLoopback}"
printfn $"IsUnc: {uri.IsUnc}"
printfn $"LocalPath: {uri.LocalPath}"
printfn $"OriginalString: {uri.OriginalString}"
printfn $"PathAndQuery: {uri.PathAndQuery}"
printfn $"Port: {uri.Port}"
printfn $"Query: {uri.Query}"
printfn $"Scheme: {uri.Scheme}"
printfn $"""Segments: {String.Join(", ", uri.Segments)}"""
printfn $"UserEscaped: {uri.UserEscaped}"
printfn $"UserInfo: {uri.UserInfo}"

// AbsolutePath: /Home/Index.htm
// AbsoluteUri: https://user:password@www.contoso.com:80/Home/Index.htm?q1=v1&q2=v2#FragmentName
// DnsSafeHost: www.contoso.com
// Fragment: #FragmentName
// Host: www.contoso.com
// HostNameType: Dns
// IdnHost: www.contoso.com
// IsAbsoluteUri: True
// IsDefaultPort: False
// IsFile: False
// IsLoopback: False
// IsUnc: False
// LocalPath: /Home/Index.htm
// OriginalString: https://user:password@www.contoso.com:80/Home/Index.htm?q1=v1&q2=v2#FragmentName
// PathAndQuery: /Home/Index.htm?q1=v1&q2=v2
// Port: 80
// Query: ?q1=v1&q2=v2
// Scheme: https
// Segments: /, Home/, Index.htm
// UserEscaped: False
// UserInfo: user:password

Remarks

A uniform resource identifier (URI) is a compact representation of a resource available to your application on the intranet or internet. The Uri class defines the properties and methods for handling URIs, including parsing, comparing, and combining. The Uri class properties are read-only; to create a modifiable object, use the UriBuilder class.

Relative URIs (for example, "/new/index.htm") must be expanded with respect to a base URI so that they are absolute. The MakeRelativeUri method is provided to convert absolute URIs to relative URIs when necessary.

The Uri constructors do not escape URI strings if the string is a well-formed URI including a scheme identifier.

The Uri properties return a canonical data representation in escaped encoding, with all characters with Unicode values greater than 127 replaced with their hexadecimal equivalents. To put the URI in canonical form, the Uri constructor performs the following steps:

  • Converts the URI scheme to lowercase.
  • Converts the host name to lowercase.
  • If the host name is an IPv6 address, the canonical IPv6 address is used. ScopeId and other optional IPv6 data are removed.
  • Removes default and empty port numbers.
  • Converts implicit file paths without the file:// scheme (for example, "C:\my\file") to explicit file paths with the file:// scheme.
  • Escaped characters (also known as percent-encoded octets) that don't have a reserved purpose are decoded (also known as being unescaped). These unreserved characters include uppercase and lowercase letters (%41-%5A and %61-%7A), decimal digits (%30-%39), hyphen (%2D), period (%2E), underscore (%5F), and tilde (%7E).
  • Canonicalizes the path for hierarchical URIs by compacting sequences such as /./ and /../ (whether or not the sequence is escaped). Note that there are some schemes for which these sequences are not compacted.
  • For hierarchical URIs, if the host is not terminated with a forward slash (/), one is added.
  • By default, any reserved characters in the URI are escaped in accordance with RFC 2396. This behavior changes if International Resource Identifiers or International Domain Name parsing is enabled in which case reserved characters in the URI are escaped in accordance with RFC 3986 and RFC 3987.

As part of canonicalization in the constructor for some schemes, dot-segments (/./ and /../) are compacted (in other words, they're removed). The schemes for which Uri compacts segments include http, https, tcp, net.pipe, and net.tcp. For some other schemes, these sequences are not compacted. The following code snippet shows how compacting looks in practice. The escaped sequences are unescaped, if necessary, and then compacted.

var uri = new Uri("http://myUrl/../.."); // http scheme, unescaped
OR
var uri = new Uri("http://myUrl/%2E%2E/%2E%2E"); // http scheme, escaped
OR
var uri = new Uri("ftp://myUrl/../.."); // ftp scheme, unescaped
OR
var uri = new Uri("ftp://myUrl/%2E%2E/%2E%2E"); // ftp scheme, escaped

Console.WriteLine($"AbsoluteUri: {uri.AbsoluteUri}");
Console.WriteLine($"PathAndQuery: {uri.PathAndQuery}");

When this code executes, it returns output similar to the following text.

AbsoluteUri: http://myurl/
PathAndQuery: /

You can transform the contents of the Uri class from an escape encoded URI reference to a readable URI reference by using the ToString method. Note that some reserved characters might still be escaped in the output of the ToString method. This is to support unambiguous reconstruction of a URI from the value returned by ToString.

Some URIs include a fragment identifier or a query or both. A fragment identifier is any text that follows a number sign (#), not including the number sign; the fragment text is stored in the Fragment property. Query information is any text that follows a question mark (?) in the URI; the query text is stored in the Query property.

Note

The URI class supports the use of IP addresses in both quad-notation for IPv4 protocol and colon-hexadecimal for IPv6 protocol. Remember to enclose the IPv6 address in square brackets, as in http://[::1].

International resource identifier support

Web addresses are typically expressed using URIs that consist of a very restricted set of characters:

  • Upper and lower case ASCII letters from the English alphabet.
  • Digits from 0 to 9.
  • A small number of other ASCII symbols.

The specifications for URIs are documented in RFC 2396, RFC 2732, RFC 3986, and RFC 3987 published by the Internet Engineering Task Force (IETF).

Identifiers that facilitate the need to identify resources using languages other than English and allow non-ASCII characters (characters in the Unicode/ISO 10646 character set) are known as International Resource Identifiers (IRIs). The specifications for IRIs are documented in RFC 3987 published by IETF. Using IRIs allows a URL to contain Unicode characters. Normalization and character checking are done according to the latest IRI rules in RFC 3986 and RFC 3987.

IRI and IDN processing in the Uri class can be controlled using the System.Configuration.IriParsingElement, System.Configuration.IdnElement, and System.Configuration.UriSection configuration setting classes. The System.Configuration.IriParsingElement setting enables or disables IRI processing in the Uri class. The System.Configuration.IdnElement setting enables or disables IDN processing in the Uri class.

The configuration setting for the System.Configuration.IriParsingElement and System.Configuration.IdnElement are read once when the first System.Uri class is constructed. Changes to configuration settings after that time are ignored.

The System.GenericUriParser class has also been extended to allow creating a customizable parser that supports IRI and IDN. The behavior of a System.GenericUriParser object is specified by passing a bitwise combination of the values available in the System.GenericUriParserOptions enumeration to the System.GenericUriParser constructor. The GenericUriParserOptions.IriParsing type indicates the parser supports the parsing rules specified in RFC 3987 for International Resource Identifiers (IRI).

The GenericUriParserOptions.Idn type indicates that the parser supports Internationalized Domain Name (IDN) parsing of host names. In .NET (Core) and .NET Framework 4.5+, IDN is always used. In previous versions, a configuration option determines whether IDN is used.

Implicit file path support

Uri can also be used to represent local file system paths. These paths can be represented explicitly in URIs that begin with the file:// scheme, and implicitly in URIs that do not have the file:// scheme. As a concrete example, the following two URIs are both valid, and represent the same file path:

Uri uri1 = new Uri("C:/test/path/file.txt") // Implicit file path.
Uri uri2 = new Uri("file:///C:/test/path/file.txt") // Explicit file path.

These implicit file paths are not compliant with the URI specification and should be avoided when possible. When using .NET Core on Unix-based systems, implicit file paths can be especially problematic, because an absolute implicit file path is indistinguishable from a relative path. When such ambiguity is present, Uri default to interpreting the path as an absolute URI.

Security considerations

Because of security concerns, your application should use caution when accepting Uri instances from untrusted sources and with dontEscape set to true in the constructor. You can check a URI string for validity by calling the IsWellFormedOriginalString method.

When dealing with untrusted user input, confirm assumptions about the newly created Uri instance before trusting its properties. This can be done in the following way:

string userInput = ...;

Uri baseUri = new Uri("https://myWebsite/files/");

if (!Uri.TryCreate(baseUri, userInput, out Uri newUri))
{
    // Fail: invalid input.
}

if (!baseUri.IsBaseOf(newUri))
{
    // Fail: the Uri base has been modified - the created Uri is not rooted in the original directory.
}

This validation can be used in other cases, like when dealing with UNC paths, by simply changing the baseUri:

Uri baseUri = new Uri(@"\\host\share\some\directory\name\");

For more details about the design and security considerations of Uri and UriBuilder, review the following threat model documents:

Performance considerations

If you use a Web.config file that contains URIs to initialize your application, additional time is required to process the URIs if their scheme identifiers are nonstandard. In such a case, initialize the affected parts of your application when the URIs are needed, not at start time.

Constructors

Name Description
Uri(SerializationInfo, StreamingContext)
Obsolete.

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

Uri(String, Boolean)
Obsolete.
Obsolete.
Obsolete.
Obsolete.

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

Uri(String, UriCreationOptions)

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

Uri(String, UriKind)

Initializes a new instance of the Uri class with the specified URI. This constructor allows you to specify if the URI string is a relative URI, absolute URI, or is indeterminate.

Uri(String)

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

Uri(Uri, String, Boolean)
Obsolete.
Obsolete.
Obsolete.
Obsolete.

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

Uri(Uri, String)

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

Uri(Uri, Uri)

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

Fields

Name Description
SchemeDelimiter

Specifies the characters that separate the communication protocol scheme from the address portion of the URI. This field is read-only.

UriSchemeData
UriSchemeFile

Specifies that the URI is a pointer to a file. This field is read-only.

UriSchemeFtp

Specifies that the URI is accessed through the File Transfer Protocol (FTP). This field is read-only.

UriSchemeFtps

Specifies that the URI is accessed through the File Transfer Protocol Secure (FTPS). This field is read-only.

UriSchemeGopher

Specifies that the URI is accessed through the Gopher protocol. This field is read-only.

UriSchemeHttp

Specifies that the URI is accessed through the Hypertext Transfer Protocol (HTTP). This field is read-only.

UriSchemeHttps

Specifies that the URI is accessed through the Secure Hypertext Transfer Protocol (HTTPS). This field is read-only.

UriSchemeMailto

Specifies that the URI is an email address and is accessed through the Simple Mail Transport Protocol (SMTP). This field is read-only.

UriSchemeNetPipe

Specifies that the URI is accessed through the NetPipe scheme used by Windows Communication Foundation (WCF). This field is read-only.

UriSchemeNetTcp

Specifies that the URI is accessed through the NetTcp scheme used by Windows Communication Foundation (WCF). This field is read-only.

UriSchemeNews

Specifies that the URI is an Internet news group and is accessed through the Network News Transport Protocol (NNTP). This field is read-only.

UriSchemeNntp

Specifies that the URI is an Internet news group and is accessed through the Network News Transport Protocol (NNTP). This field is read-only.

UriSchemeSftp

Specifies that the URI is accessed through the SSH File Transfer Protocol (SFTP). This field is read-only.

UriSchemeSsh

Specifies that the URI is accessed through the Secure Socket Shell protocol (SSH). This field is read-only.

UriSchemeTelnet

Specifies that the URI is accessed through the Telnet protocol. This field is read-only.

UriSchemeWs

Specifies that the URI is accessed through the WebSocket protocol (WS). This field is read-only.

UriSchemeWss

Specifies that the URI is accessed through the WebSocket Secure protocol (WSS). This field is read-only.

Properties

Name Description
AbsolutePath

Gets the absolute path of the URI.

AbsoluteUri

Gets the absolute URI.

Authority

Gets the Domain Name System (DNS) host name or IP address and the port number for a server.

DnsSafeHost

Gets a host name that, after being unescaped if necessary, is safe to use for DNS resolution.

Fragment

Gets the escaped URI fragment, including the leading '#' character if not empty.

Host

Gets the host component of this instance.

HostNameType

Gets the type of the host name specified in the URI.

IdnHost

Gets the RFC 3490 compliant International Domain Name of the host, using Punycode as appropriate. This string, after being unescaped if necessary, is safe to use for DNS resolution.

IsAbsoluteUri

Gets a value that indicates whether the Uri instance is absolute.

IsDefaultPort

Gets a value that indicates whether the port value of the URI is the default for this scheme.

IsFile

Gets a value that indicates whether the specified Uri is a file URI.

IsLoopback

Gets a value that indicates whether the specified Uri references the local host.

IsUnc

Gets a value that indicates whether the specified Uri is a universal naming convention (UNC) path.

LocalPath

Gets a local operating-system representation of a file name.

OriginalString

Gets the original URI string that was passed to the Uri constructor.

PathAndQuery

Gets the AbsolutePath and Query properties separated by a question mark (?).

Port

Gets the port number of this URI.

Query

Gets any query information included in the specified URI, including the leading '?' character if not empty.

Scheme

Gets the scheme name for this URI.

Segments

Gets an array containing the path segments that make up the specified URI.

UserEscaped

Gets a value that indicates whether the URI string was completely escaped before the Uri instance was created.

UserInfo

Gets the user name, password, or other user-specific information associated with the specified URI.

Methods

Name Description
Canonicalize()
Obsolete.
Obsolete.
Obsolete.

Converts the internally stored URI to canonical form.

CheckHostName(String)

Determines whether the specified host name is a valid DNS name.

CheckSchemeName(String)

Determines whether the specified scheme name is valid.

CheckSecurity()
Obsolete.
Obsolete.
Obsolete.

Calling this method has no effect.

Compare(Uri, Uri, UriComponents, UriFormat, StringComparison)

Compares the specified parts of two URIs using the specified comparison rules.

CreateObjRef(Type)

Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(Inherited from MarshalByRefObject)
Equals(Object)

Compares two Uri instances for equality.

Equals(Uri)

Compares two Uri instances for equality.

Escape()
Obsolete.
Obsolete.
Obsolete.

Converts any unsafe or reserved characters in the path component to their hexadecimal character representations.

EscapeDataString(ReadOnlySpan<Char>)

Converts a span to its escaped representation.

EscapeDataString(String)

Converts a string to its escaped representation.

EscapeString(String)
Obsolete.
Obsolete.
Obsolete.
Obsolete.

Converts a string to its escaped representation.

EscapeUriString(String)
Obsolete.
Obsolete.

Converts a URI string to its escaped representation.

FromHex(Char)

Gets the decimal value of a hexadecimal digit.

GetComponents(UriComponents, UriFormat)

Gets the specified components of the current instance using the specified escaping for special characters.

GetHashCode()

Gets the hash code for the URI.

GetLeftPart(UriPartial)

Gets the specified portion of a Uri instance.

GetLifetimeService()
Obsolete.

Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
GetObjectData(SerializationInfo, StreamingContext)

Returns the data needed to serialize the current instance.

GetType()

Gets the Type of the current instance.

(Inherited from Object)
HexEscape(Char)

Converts a specified character into its hexadecimal equivalent.

HexUnescape(String, Int32)

Converts a specified hexadecimal representation of a character to the character.

InitializeLifetimeService()
Obsolete.

Obtains a lifetime service object to control the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
IsBadFileSystemCharacter(Char)
Obsolete.
Obsolete.
Obsolete.

Indicates whether a character is invalid in a file system name.

IsBaseOf(Uri)

Determines whether the current Uri instance is a base of the specified Uri instance.

IsExcludedCharacter(Char)
Obsolete.
Obsolete.
Obsolete.

Determines whether the specified character should be escaped.

IsHexDigit(Char)

Determines whether a specified character is a valid hexadecimal digit.

IsHexEncoding(String, Int32)

Determines whether a character in a string is hexadecimal encoded.

IsReservedCharacter(Char)
Obsolete.
Obsolete.
Obsolete.

Determines whether the specified character is a reserved character.

IsWellFormedOriginalString()

Indicates whether the string used to construct this Uri was well-formed and does not require further escaping.

IsWellFormedUriString(String, UriKind)

Indicates whether the string is well-formed by attempting to construct a URI with the string and ensures that the string does not require further escaping.

MakeRelative(Uri)
Obsolete.
Obsolete.
Obsolete.
Obsolete.

Determines the difference between two Uri instances.

MakeRelativeUri(Uri)

Determines the difference between two Uri instances.

MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
Parse()
Obsolete.
Obsolete.
Obsolete.

Parses the URI of the current instance to ensure it contains all the parts required for a valid URI.

ToString()

Gets a canonical string representation for the specified Uri instance.

TryCreate(String, UriCreationOptions, Uri)

Creates a new Uri using the specified String instance and UriCreationOptions.

TryCreate(String, UriKind, Uri)

Creates a new Uri using the specified String instance and a UriKind.

TryCreate(Uri, String, Uri)

Creates a new Uri using the specified base and relative String instances.

TryCreate(Uri, Uri, Uri)

Creates a new Uri using the specified base and relative Uri instances.

TryEscapeDataString(ReadOnlySpan<Char>, Span<Char>, Int32)

Attempts to convert a span to its escaped representation.

TryFormat(Span<Char>, Int32)

Attempts to format a canonical string representation for the Uri instance into the specified span.

TryUnescapeDataString(ReadOnlySpan<Char>, Span<Char>, Int32)

Attempts to convert a span to its unescaped representation.

Unescape(String)
Obsolete.
Obsolete.
Obsolete.

Converts the specified string by replacing any escape sequences with their unescaped representation.

UnescapeDataString(ReadOnlySpan<Char>)

Converts a span to its unescaped representation.

UnescapeDataString(String)

Converts a string to its unescaped representation.

Operators

Name Description
Equality(Uri, Uri)

Determines whether two Uri instances have the same value.

Inequality(Uri, Uri)

Determines whether two Uri instances do not have the same value.

Explicit Interface Implementations

Name Description
IFormattable.ToString(String, IFormatProvider)

Formats the value of the current instance using the specified format.

ISerializable.GetObjectData(SerializationInfo, StreamingContext)

Returns the data needed to serialize the current instance.

ISpanFormattable.TryFormat(Span<Char>, Int32, ReadOnlySpan<Char>, IFormatProvider)

Tries to format the value of the current instance into the provided span of characters.

Applies to

Thread Safety

All members of Uri are thread-safe and may be used concurrently from multiple threads.

See also