Ferrous API Reference

All Types / Ferrous.Results

struct NonEmptyString [NoDefault]

public readonly struct NonEmptyString : IEquatable<NonEmptyString>, IComparable<NonEmptyString>

A zero-allocation wrapper guaranteeing a non-null, non-whitespace string.

Properties

public string Value

Gets the guaranteed non-empty underlying string.

Exceptions
InvalidOperationException
Thrown if default-initialized.
public int Length

Gets the length of the underlying string.

Methods

public static Option<NonEmptyString> TryCreate(string? value)

Creates a NonEmptyString if value is non-null and not whitespace; otherwise Option<T>.None.

public bool Equals(NonEmptyString other)
public override bool Equals(object? obj)
public override int GetHashCode()
public int CompareTo(NonEmptyString other)
public override string ToString()