Struct NUnitString
A class to allow postponing the actual formatting of interpolated strings.
Inherited Members
Namespace: NUnit.Framework
Assembly: nunit.framework.dll
Syntax
public readonly struct NUnitString
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
View SourceNUnitString(string?)
Initializes a new instance of the NUnitString class.
Declaration
public NUnitString(string? message)
Parameters
Type | Name | Description |
---|---|---|
string | message | The message formattable to hold. |
Methods
View SourceToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string |
Overrides
Operators
View Sourceimplicit operator NUnitString(FormattableString)
Implicit conversion from a FormattableString to a NUnitString.
Declaration
[Obsolete("This only exists for the compiler")]
public static implicit operator NUnitString(FormattableString formattableMessage)
Parameters
Type | Name | Description |
---|---|---|
FormattableString | formattableMessage | The message formattable to hold. |
Returns
Type | Description |
---|---|
NUnitString |
Remarks
Should never be called. It only exists for the compiler.
implicit operator NUnitString(string?)
Implicit conversion from a string to a NUnitString.
Declaration
public static implicit operator NUnitString(string? message)
Parameters
Type | Name | Description |
---|---|---|
string | message | The message formattable to hold. |
Returns
Type | Description |
---|---|
NUnitString |