EventDataBatch.TryAdd(EventData) Method

Definition

Tries to add an event data to the batch if permitted by the batch's size limit.

public bool TryAdd (Microsoft.Azure.EventHubs.EventData eventData);
member this.TryAdd : Microsoft.Azure.EventHubs.EventData -> bool
Public Function TryAdd (eventData As EventData) As Boolean

Parameters

eventData
EventData

The EventData to add.

Returns

System.Boolean

A boolean value indicating if the event data has been added to the batch or not.

Exceptions

System.ArgumentNullException

Thrown when the EventData is null.

System.ObjectDisposedException

Thrown when the batch is already disposed.

Remarks

This method checks the sizes of the batch, the EventData object and the specified limit to determine if the EventData object can be added.

Applies to