Skip to content

MessageId Methods

Identifies one message by an application-supplied HierarchicalKey.

Create(ReadOnlySpan<string>)

static
View source
public static MessageId Create(params ReadOnlySpan<string> segments)
Creates a message identity from literal segments in root-first order.

Parameters

segmentsReadOnlySpan<string>
The nonempty literal segments.

Returns

The message identity.

Exceptions

System.ArgumentNullException
A segment is null.
System.ArgumentException
The input or a segment is empty, or a segment contains an unpaired surrogate.

Equals(MessageId)

View source
public bool Equals(MessageId other)
Indicates whether the current object is equal to another object of the same type.

Parameters

otherMessageId
An object to compare with this object.

Returns

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

override
View source
public override bool Equals(object? obj)
Indicates whether this instance and a specified object are equal.

Parameters

objobject?
The object to compare with the current instance.

Returns

true if obj and this instance are the same type and represent the same value; otherwise, false.

GetHashCode

override
View source
public override int GetHashCode()
Returns the hash code for this instance.

Returns

A 32-bit signed integer that is the hash code for this instance.

Parse(ReadOnlySpan<char>, IFormatProvider?)

static
View source
public static MessageId Parse(ReadOnlySpan<char> s, IFormatProvider? provider = null)
Parses a span of characters into a value.

Parameters

sReadOnlySpan<char>
The span of characters to parse.
providerIFormatProvider?
An object that provides culture-specific formatting information about s.

Returns

The result of parsing s.

Exceptions

System.FormatException
s is not in the correct format.
System.OverflowException
s is not representable by TSelf.

Parse(string, IFormatProvider?)

static
View source
public static MessageId Parse(string s, IFormatProvider? provider = null)
Parses a string into a value.

Parameters

sstring
The string to parse.
providerIFormatProvider?
An object that provides culture-specific formatting information about s.

Returns

The result of parsing s.

Exceptions

System.ArgumentNullException
s is null.
System.FormatException
s is not in the correct format.
System.OverflowException
s is not representable by TSelf.

ToString

override
View source
public override string ToString()
Returns the fully qualified type name of this instance.

Returns

The fully qualified type name.

ToString(string?, IFormatProvider?)

View source
public string ToString(string? format, IFormatProvider? formatProvider)
Formats the value of the current instance using the specified format.

Parameters

formatstring?
The format to use. -or- A null reference (Nothing in Visual Basic) to use the default format defined for the type of the System.IFormattable implementation.
formatProviderIFormatProvider?
The provider to use to format the value. -or- A null reference (Nothing in Visual Basic) to obtain the numeric format information from the current locale setting of the operating system.

Returns

The value of the current instance in the specified format.

TryFormat(Span<char>, int, ReadOnlySpan<char>, IFormatProvider?)

View source
public bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider? provider)
Tries to format the value of the current instance into the provided span of characters.

Parameters

destinationSpan<char>
The span in which to write this instance's value formatted as a span of characters.
charsWrittenint
When this method returns, contains the number of characters that were written in destination.
formatReadOnlySpan<char>
A span containing the characters that represent a standard or custom format string that defines the acceptable format for destination.
providerIFormatProvider?
An optional object that supplies culture-specific formatting information for destination.

Returns

true if the formatting was successful; otherwise, false.

TryParse(ReadOnlySpan<char>, IFormatProvider?, MessageId)

static
View source
public static bool TryParse(ReadOnlySpan<char> s, IFormatProvider? provider, out MessageId result)
Tries to parse a span of characters into a value.

Parameters

sReadOnlySpan<char>
The span of characters to parse.
providerIFormatProvider?
An object that provides culture-specific formatting information about s.
resultMessageId
When this method returns, contains the result of successfully parsing s, or an undefined value on failure.

Returns

true if s was successfully parsed; otherwise, false.

TryParse(string?, IFormatProvider?, MessageId)

static
View source
public static bool TryParse(string? s, IFormatProvider? provider, out MessageId result)
Tries to parse a string into a value.

Parameters

sstring?
The string to parse.
providerIFormatProvider?
An object that provides culture-specific formatting information about s.
resultMessageId
When this method returns, contains the result of successfully parsing s or an undefined value on failure.

Returns

true if s was successfully parsed; otherwise, false.

operator ==(MessageId, MessageId)

static
View source
public static bool operator ==(MessageId left, MessageId right)
Compares message identities.

Parameters

leftMessageId
The first identity.
rightMessageId
The second identity.

Returns

Whether the identities are equal.

operator !=(MessageId, MessageId)

static
View source
public static bool operator !=(MessageId left, MessageId right)
Compares message identities for inequality.

Parameters

leftMessageId
The first identity.
rightMessageId
The second identity.

Returns

Whether the identities differ.