Class EventData | Azure SDK for .NET
Jessica Wood
Published Feb 16, 2026
A set of data encapsulating an event and the associated metadata for use with Event Hubs operations.
Inheritance
System.Object
EventData
Namespace: System.Dynamic.ExpandoObject
Assembly: Azure.Messaging.EventHubs.dll
Syntax
public class EventData Constructors
EventData(BinaryData)
Initializes a new instance of the EventData class.
Declaration
public EventData (BinaryData eventBody); Parameters
| System.BinaryData eventBody The raw data as binary to use as the body of the event. |
EventData(ReadOnlyMemory<Byte>)
Initializes a new instance of the EventData class.
Declaration
public EventData (ReadOnlyMemory<byte> eventBody); Parameters
| System.ReadOnlyMemory<System.Byte> eventBody The raw data to use as the body of the event. |
EventData(BinaryData, IDictionary<String,Object>, IReadOnlyDictionary<String,Object>, Int64, Int64, DateTimeOffset, String)
Initializes a new instance of the EventData class.
Declaration
[System.ComponentModel.EditorBrowsable]
protected EventData (BinaryData eventBody, System.Collections.Generic.IDictionary<string,object> properties = null, System.Collections.Generic.IReadOnlyDictionary<string,object> systemProperties = null, long sequenceNumber = -9223372036854775808, long offset = -9223372036854775808, DateTimeOffset enqueuedTime = null, string partitionKey = null); Parameters
| System.BinaryData eventBody The raw data to use as the body of the event. |
| System.Collections.Generic.IDictionary<System.String,System.Object> properties The set of free-form event properties to send with the event. |
| System.Collections.Generic.IReadOnlyDictionary<System.String,System.Object> systemProperties The set of system properties received from the Event Hubs service. |
| System.Int64 sequenceNumber The sequence number assigned to the event when it was enqueued in the associated Event Hub partition. |
| System.Int64 offset The offset of the event when it was received from the associated Event Hub partition. |
| System.DateTimeOffset enqueuedTime The date and time, in UTC, of when the event was enqueued in the Event Hub partition. |
| System.String partitionKey The partition hashing key associated with the event when it was published. |
EventData(ReadOnlyMemory<Byte>, IDictionary<String,Object>, IReadOnlyDictionary<String,Object>, Int64, Int64, DateTimeOffset, String)
Initializes a new instance of the EventData class.
Declaration
[System.ComponentModel.EditorBrowsable]
protected EventData (ReadOnlyMemory<byte> eventBody, System.Collections.Generic.IDictionary<string,object> properties = null, System.Collections.Generic.IReadOnlyDictionary<string,object> systemProperties = null, long sequenceNumber = -9223372036854775808, long offset = -9223372036854775808, DateTimeOffset enqueuedTime = null, string partitionKey = null); Parameters
| System.ReadOnlyMemory<System.Byte> eventBody The raw data to use as the body of the event. |
| System.Collections.Generic.IDictionary<System.String,System.Object> properties The set of free-form event properties to send with the event. |
| System.Collections.Generic.IReadOnlyDictionary<System.String,System.Object> systemProperties The set of system properties received from the Event Hubs service. |
| System.Int64 sequenceNumber The sequence number assigned to the event when it was enqueued in the associated Event Hub partition. |
| System.Int64 offset The offset of the event when it was received from the associated Event Hub partition. |
| System.DateTimeOffset enqueuedTime The date and time, in UTC, of when the event was enqueued in the Event Hub partition. |
| System.String partitionKey The partition hashing key associated with the event when it was published. |
Properties
Body
The data associated with the event.
Declaration
[System.ComponentModel.EditorBrowsable]
public ReadOnlyMemory<byte> Body { get; } Property Value
| System.ReadOnlyMemory<System.Byte> |
Remarks
See Also
BodyAsStream
The data associated with the event, in stream form.
Declaration
[System.ComponentModel.EditorBrowsable]
public System.IO.Stream BodyAsStream { get; } Property Value
| System.IO.Stream A System.IO.Stream containing the raw data representing the EventBodyof the event. The caller is assumed to have ownership of the stream, including responsibility for managing its lifespan and ensuring proper disposal. |
Remarks
See Also
EnqueuedTime
The date and time, in UTC, of when the event was enqueued in the Event Hub partition.
Declaration
public DateTimeOffset EnqueuedTime { get; } Property Value
| System.DateTimeOffset |
EventBody
The data associated with the event, in System.BinaryData form, providing support for a variety of data transformations and Azure.Core.Serialization.ObjectSerializer integration.
Declaration
public BinaryData EventBody { get; } Property Value
| System.BinaryData |
Remarks
See Also
Offset
The offset of the event when it was received from the associated Event Hub partition.
Declaration
public long Offset { get; } Property Value
| System.Int64 |
PartitionKey
The partition hashing key applied to the batch that the associated EventData, was published with.
Declaration
public string PartitionKey { get; } Property Value
| System.String |
Properties
The set of free-form event properties which may be used for passing metadata associated with the event body during Event Hubs operations.
Declaration
public System.Collections.Generic.IDictionary<string,object> Properties { get; } Property Value
| System.Collections.Generic.IDictionary<System.String,System.Object> |
Examples
var eventData = new EventData(serializedTelemetryData); eventData.Properties["eventType"] = "com.microsoft.Azure.monitoring.EtlEvent"; SequenceNumber
The sequence number assigned to the event when it was enqueued in the associated Event Hub partition.
Declaration
public long SequenceNumber { get; } Property Value
| System.Int64 |
SystemProperties
The set of free-form event properties which were provided by the Event Hubs service to pass metadata associated with the event or associated Event Hubs operation.
Declaration
public System.Collections.Generic.IReadOnlyDictionary<string,object> SystemProperties { get; } Property Value
| System.Collections.Generic.IReadOnlyDictionary<System.String,System.Object> |
Methods
Equals(Object)
Determines whether the specified System.Object is equal to this instance.
Declaration
[System.ComponentModel.EditorBrowsable]
public override bool Equals (object obj); Parameters
| System.Object obj The System.Object to compare with this instance. |
Returns
| System.Boolean
|
GetHashCode()
Returns a hash code for this instance.
Declaration
[System.ComponentModel.EditorBrowsable]
public override int GetHashCode (); Returns
| System.Int32 A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. |
ToString()
Converts the instance to string representation.
Declaration
[System.ComponentModel.EditorBrowsable]
public override string ToString (); Returns
| System.String A System.String that represents this instance. |