Struct NUnitString
A class to allow postponing the actual formatting of interpolated strings.
public readonly struct NUnitString
- Inherited Members
Remarks
This class is needed as the compiler prefers to call a string overload vs a FormattableString overload. https://www.damirscorner.com/blog/posts/20180921-FormattableStringAsMethodParameter.html
Constructors
NUnitString(string?)
Initializes a new instance of the NUnitString class.
public NUnitString(string? message)
Parameters
message
stringThe message formattable to hold.
Methods
ToString()
public override string ToString()
Returns
Operators
implicit operator NUnitString(FormattableString)
Implicit conversion from a FormattableString to a NUnitString.
[Obsolete("This only exists for the compiler")]
public static implicit operator NUnitString(FormattableString formattableMessage)
Parameters
formattableMessage
FormattableStringThe message formattable to hold.
Returns
Remarks
Should never be called. It only exists for the compiler.
implicit operator NUnitString(string?)
Implicit conversion from a string to a NUnitString.
public static implicit operator NUnitString(string? message)
Parameters
message
stringThe message formattable to hold.