logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class OnceGuard

    Lets a piece of work happen exactly once, with no key to distinguish call sites — the single-latch form of OnceGuard<TKey>.

    Inheritance
    object
    OnceGuard
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    Namespace: Serenity.Shared.Utils
    Assembly: Serenity.Shared.dll
    Syntax
    public sealed class OnceGuard

    Constructors

    OnceGuard()

    Declaration
    public OnceGuard()

    Properties

    HasEntered

    Whether the guarded work has already happened.

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

    Methods

    Reset()

    Unlatches, so the guarded work can happen once more.

    Declaration
    public void Reset()

    TryEnter()

    Reports whether this is the first call, and latches.

    Declaration
    public bool TryEnter()
    Returns
    Type Description
    bool

    True on the first call; false on every later one.

    In this article
    © 2026 Serenity. All Rights Reserved