Struct MessageArgument
- Namespace
- RentADeveloper.ResXLocalization
- Assembly
- ResXLocalization.Core.dll
One argument of a lookup: its position, an optional name and its value. The arguments of one lookup are a MessageArguments; no arguments is Empty.
public readonly record struct MessageArgument : IEquatable<MessageArgument>
- Implements
- Inherited Members
Remarks
MessageArgument is what an IMessageFormatter receives - a resolved
value. In XAML an argument is declared as <l:Argument>, which becomes a
MessageArgument at each conversion, with its index among the children as
Position and its Name.
Constructors
MessageArgument(int, string?, object?)
One argument of a lookup: its position, an optional name and its value. The arguments of one lookup are a MessageArguments; no arguments is Empty.
public MessageArgument(int Position, string? Name, object? Value)
Parameters
PositionintThe argument's position: the argument at position 0 fills placeholder
{0}, and so on, also when it has a name. This is the only source of an argument's position: an argument's index in the enumeration of a MessageArguments is not guaranteed to be the same as its position.Namestringnull for a positional-only argument; otherwise the name under which a formatter that understands names (ICU MessageFormat) also finds the argument. The default (Format(IFormatProvider, string, params object[])) formatter uses positions only and ignores names. The ICU MessageFormat formatter of the ResXLocalization.MessageFormat package makes every argument reachable under its position (
"0","1", and so on) and, if it has a name, under that name as well; a name overwrites a position with the same text, so the argument named"0"replaces the argument at position 0 as{0}.ValueobjectThe argument's value; may be null.
Remarks
MessageArgument is what an IMessageFormatter receives - a resolved
value. In XAML an argument is declared as <l:Argument>, which becomes a
MessageArgument at each conversion, with its index among the children as
Position and its Name.
Properties
Name
null for a positional-only argument; otherwise the name under which a formatter
that understands names (ICU MessageFormat) also finds the argument. The default
(Format(IFormatProvider, string, params object[])) formatter uses positions only and
ignores names. The ICU MessageFormat formatter of the ResXLocalization.MessageFormat package makes every
argument reachable under its position ("0", "1", and so on) and, if it has a name, under
that name as well; a name overwrites a position with the same text, so the argument named "0"
replaces the argument at position 0 as {0}.
public string? Name { get; init; }
Property Value
Position
The argument's position: the argument at position 0 fills placeholder {0}, and so on, also when it
has a name. This is the only source of an argument's position: an argument's index in the enumeration of
a MessageArguments is not guaranteed to be the same as its position.
public int Position { get; init; }
Property Value
Value
The argument's value; may be null.
public object? Value { get; init; }