Stride

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
    Show / Hide Table of Contents

    EventReceiver<T> Class

    Namespace: Stride.Engine.Events
    Assembly: Stride.Engine.dll

    Creates an event receiver that is used to receive T type events from an EventKey

    System.Object → EventReceiverBase → EventReceiverBase<T> → EventReceiver<T>
    Derived from EventReceiver<T>:

    public sealed class EventReceiver<T> : EventReceiverBase<T>, IDisposable
    Type Parameters
    Name Description
    T

    The type of data the EventKey will send

    Name Description
    Constructors
    EventReceiver(EventKey<T>, EventReceiverOptions)

    Creates an event receiver, ready to receive broadcasts from the key

    Methods
    ReceiveAsync()

    Awaits a single event

    TryReceive(out T)

    Receives one event from the buffer, useful specially in Sync scripts

    TryReceiveAll(ICollection<T>)

    Receives all the events from the queue (if buffered was true during creations), useful mostly only in Sync scripts

    | Improve this Doc View Source

    Constructors


    EventReceiver(EventKey<T>, EventReceiverOptions)

    Creates an event receiver, ready to receive broadcasts from the key

    public EventReceiver(EventKey<T> key, EventReceiverOptions options = EventReceiverOptions.None)
    Parameters
    Type Name Description
    EventKey<T> key

    The event key to listen from

    EventReceiverOptions options

    Option flags

    | Improve this Doc View Source

    Methods


    ReceiveAsync()

    Awaits a single event

    public Task<T> ReceiveAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task<T>

    TryReceive(out T)

    Receives one event from the buffer, useful specially in Sync scripts

    public bool TryReceive(out T data)
    Parameters
    Type Name Description
    T data
    Returns
    Type Description
    System.Boolean

    TryReceiveAll(ICollection<T>)

    Receives all the events from the queue (if buffered was true during creations), useful mostly only in Sync scripts

    public int TryReceiveAll(ICollection<T> collection)
    Parameters
    Type Name Description
    System.Collections.Generic.ICollection<T> collection
    Returns
    Type Description
    System.Int32

    Inherited Members

    EventReceiverBase<T>.Key
    EventReceiverBase<T>.InternalReceiveAsync()
    EventReceiverBase<T>.GetAwaiter()
    EventReceiverBase<T>.Count
    EventReceiverBase<T>.InternalTryReceive(T)
    EventReceiverBase<T>.InternalTryReceiveAll(ICollection<T>)
    EventReceiverBase<T>.Reset()
    EventReceiverBase<T>.Dispose()

    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    • Improve this Doc
    • View Source
    In This Article

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation