Search Results for

    Show / Hide Table of Contents

    Class LatestMailbox<T>

    A thread-safe mailbox that always holds at most one message of type T. When a new message is added, it overwrites any existing message. This is useful in scenarios where only the most recent message is relevant, such as UI or viewport updates, and outdated messages should be ignored.

    Inheritance
    object
    LatestMailbox<T>
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Mapsui.Fetcher
    Assembly: Mapsui.dll
    Syntax
    public class LatestMailbox<T> where T : class
    Type Parameters
    Name Description
    T

    The type of message to store. Must be a reference type.

    Properties

    | Edit this page View Source

    IsEmpty

    Declaration
    public bool IsEmpty { get; }
    Property Value
    Type Description
    bool

    Methods

    | Edit this page View Source

    Overwrite(T)

    Stores the specified message in the mailbox, replacing any previous message. If a message was already present, it is discarded and replaced by the new one.

    Declaration
    public void Overwrite(T message)
    Parameters
    Type Name Description
    T message

    The message to store. Cannot be null.

    | Edit this page View Source

    TryTake(out T)

    Attempts to retrieve and remove the current message from the mailbox. If a message is present, it is returned and the mailbox is cleared. If no message is present, returns false.

    Declaration
    public bool TryTake(out T message)
    Parameters
    Type Name Description
    T message

    When this method returns, contains the message retrieved from the mailbox, or null if the mailbox was empty.

    Returns
    Type Description
    bool

    True if a message was present and retrieved; false if the mailbox was empty.

    Extension Methods

    DisposableExtension.DisposeIfDisposable(object?)
    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX