LazyString

References
public sealed class LazyString
A process which computes a string lazily in a background thread.

Constructors

LazyString

#
public LazyString(string final)
Create a lazy string with a precomputed result.
final (string)Available result.

LazyString

#
public LazyString(string placeholder, Func<string> computeFinal)
Create a new lazy string.
placeholder (string)String to display initially. Any triple dots will be used to insert progress feedback.
computeFinal (Func<string>)Method for computing the final string.

Properties

Computed

#
public bool Computed { get; }
Gets whether this instance has finished computing the Display(bool) string.

Empty

#
public static LazyString Empty { get; }
Gets an empty lazy string.

Final

#
public string Final { get; }
Gets the final, computed string. This field will return null while the computation is still ongoing.

Placeholder

#
public string Placeholder { get; }
Gets the fallback string to be returned while the process is still computing. This never returns null.

Methods

Display

#
public string Display(out bool final)
Gets the current display string. This will either be the Placeholder string or the Final string.
final (out bool)

Convertors

OperationResultDescription
implicitstringLazyStringCreate a completed lazy string from a result.