Table of Contents

Struct NUnitString

Namespace
NUnit.Framework
Assembly
nunit.framework.dll

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 string

The message formattable to hold.

Methods

ToString()

public override string ToString()

Returns

string

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 FormattableString

The message formattable to hold.

Returns

NUnitString

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 string

The message formattable to hold.

Returns

NUnitString