Search Results for

    Show / Hide Table of Contents

    Struct NUnitString

    A class to allow postponing the actual formatting of interpolated strings.

    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    object.GetType()
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    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 Source

    NUnitString(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 Source

    ToString()

    Declaration
    public override string ToString()
    Returns
    Type Description
    string
    Overrides
    ValueType.ToString()

    Operators

    View Source

    implicit 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.

    View Source

    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
    • View Source
    In this article
    Back to top Generated by DocFX | Copyright (c) 2018- The NUnit Project - Licensed under CC BY-NC-SA 4.0