Table of Contents

Struct Iri

Namespace
Xapi
Assembly
Xapi.Core.dll

An absolute Internationalized Resource Identifier (RFC 3987), such as an Activity id, a Verb id or an extension key. Also used for IRLs (moreInfo, homePage, openid, fileUrl).

public readonly record struct Iri : IEquatable<Iri>
Implements
Inherited Members

Remarks

The original text is kept exactly and equality is ordinal string comparison (RFC 3987, 5.3.1), which is what IEEE 9274.1.1, 4.2.7 allows an LRS to use. Unlike Uri, nothing is normalized.

Constructors

Iri(string)

Creates an IRI.

public Iri(string value)

Parameters

value string

An absolute IRI: a scheme, a colon and a non-empty remainder.

Exceptions

ArgumentNullException

value is null.

FormatException

value is not an absolute IRI.

Properties

IsEmpty

Whether this is the default struct value, which is not a valid IRI.

public bool IsEmpty { get; }

Property Value

bool

Value

The IRI text exactly as given. Empty only for the default struct value.

public string Value { get; }

Property Value

string

Methods

FromUri(Uri)

Creates an IRI from an absolute Uri, using the text the URI was created from.

public static Iri FromUri(Uri uri)

Parameters

uri Uri

An absolute URI.

Returns

Iri

The IRI.

Exceptions

FormatException

The URI is relative or not a valid IRI.

ToString()

Returns Value.

public override string ToString()

Returns

string

The IRI text.

ToUri()

Converts to a Uri. Some valid IRIs may not be accepted by Uri.

public Uri ToUri()

Returns

Uri

The URI.

TryParse(string?, out Iri)

Tries to create an IRI.

public static bool TryParse(string? value, out Iri iri)

Parameters

value string

The candidate text.

iri Iri

The IRI when the method returns true.

Returns

bool

true when value is an absolute IRI.