Search Results for

    Show / Hide Table of Contents

    Class MessageCollection<T1, T2>

    A collection of messages.

    Inheritance
    Object
    MessageCollection
    MessageCollection<T1, T2>
    MessageCollection<T1, T2, T3>
    Implements
    IDisposable
    Inherited Members
    MessageCollection.GetEnumerator()
    MessageCollection.Dispose()
    Namespace: Agents.Net
    Assembly: Agents.Net.dll
    Syntax
    public class MessageCollection<T1, T2> : MessageCollection, IDisposable where T1 : Message where T2 : Message
    Type Parameters
    Name Description
    T1
    T2
    Remarks

    This is a helper class for the MessageCollector<T1, T2>

    Constructors

    | Improve this Doc View Source

    MessageCollection(MessageStore<T1>, MessageStore<T2>, MessageCollector<T1, T2>)

    Initialized a new instance of the class MessageCollection<T1, T2>.

    Declaration
    public MessageCollection(MessageStore<T1> message1, MessageStore<T2> message2, MessageCollector<T1, T2> collector)
    Parameters
    Type Name Description
    MessageStore<T1> message1

    Message of type T1.

    MessageStore<T2> message2

    Message of type T2.

    MessageCollector<T1, T2> collector

    The MessageCollector<T1, T2> that produced this instance.

    Properties

    | Improve this Doc View Source

    Message1

    Message of type T1.

    Declaration
    public T1 Message1 { get; }
    Property Value
    Type Description
    T1
    | Improve this Doc View Source

    Message2

    Message of type T2.

    Declaration
    public T2 Message2 { get; }
    Property Value
    Type Description
    T2

    Methods

    | Improve this Doc View Source

    Dispose(Boolean)

    Disposes all MessageStore<T>s contained in this collection

    Declaration
    protected override void Dispose(bool disposing)
    Parameters
    Type Name Description
    Boolean disposing
    Overrides
    MessageCollection.Dispose(Boolean)
    Remarks

    This releases the usage of the message and therefore potentially disposes the contained Message. When a message is used more than once in the MessageCollector<T1, T2>, the Agent that contains the MessageCollector<T1, T2> should mark the message with DelayDispose().

    | Improve this Doc View Source

    GetAllMessages()

    When overridden needs to return all messages in the collection.

    Declaration
    protected override IEnumerable<Message> GetAllMessages()
    Returns
    Type Description
    IEnumerable<Message>
    Overrides
    MessageCollection.GetAllMessages()
    | Improve this Doc View Source

    MarkAsConsumed(Message)

    Mark the specified message as consumed.

    Declaration
    public override void MarkAsConsumed(Message message)
    Parameters
    Type Name Description
    Message message

    The message that will be marked.

    Overrides
    MessageCollection.MarkAsConsumed(Message)
    Remarks

    The usual behavior for the MessageCollector<T1, T2> is to retain all messages that were collected, until other message of the same type replaces the the old message. This method changes that behavior, so that the marked message is removed from the collector afterwards.

    Implements

    IDisposable
    • Improve this Doc
    • View Source
    In This Article
    Back to top © Copyright Tobias Wilker and contributors