Share via


EventData Constructors

Definition

Overloads

EventData()

Initializes a new instance of the EventData class.

EventData(Byte[])

Initializes a new instance of the EventData class that uses the specified byte array as the body.

EventData(IList<ArraySegment<Byte>>)

Initializes a new instance of the EventData class that uses the specified list of byte array segments as the body.

EventData(Stream)

Initializes a new instance of the EventData class that uses the argument stream as the body stream.

EventData(Object, XmlObjectSerializer)

Constructor which takes the input content and serializer to create the body stream.

EventData()

Initializes a new instance of the EventData class.

public EventData ();
Public Sub New ()

Applies to

EventData(Byte[])

Initializes a new instance of the EventData class that uses the specified byte array as the body.

public EventData (byte[] byteArray);
new Microsoft.ServiceBus.Messaging.EventData : byte[] -> Microsoft.ServiceBus.Messaging.EventData
Public Sub New (byteArray As Byte())

Parameters

byteArray
Byte[]

The event data byte array which is used to form the body stream.

Remarks

You should treat the input byte array as immutable when sending EventData.

When sending the data as well as any cloning operation, Service Bus will access the byte array by reference rather that by deep copy of the byte array. Also disposing the EventData instance will only de-reference the association with the array. The user is responsible for the lifecycle of the byte-array itself.

Applies to

EventData(IList<ArraySegment<Byte>>)

Initializes a new instance of the EventData class that uses the specified list of byte array segments as the body.

public EventData (System.Collections.Generic.IList<ArraySegment<byte>> arraySegments);
new Microsoft.ServiceBus.Messaging.EventData : System.Collections.Generic.IList<ArraySegment<byte>> -> Microsoft.ServiceBus.Messaging.EventData
Public Sub New (arraySegments As IList(Of ArraySegment(Of Byte)))

Parameters

arraySegments
IList<ArraySegment<Byte>>

An IList of array segments to be sent as the body of the EventData.

Remarks

Typically user will use IList<ArraySegment<byte>> when using there own buffer pool for scenarios that require efficient usage of memory.

When sending the data as well as any cloning operation, Service Bus will access the array segments by reference rather that by deep copy of the bytes.

Disposing the EventData instance will only de-reference the association with the list. User is responsible for the life cycle of the array segments themselves.

Applies to

EventData(Stream)

Initializes a new instance of the EventData class that uses the argument stream as the body stream.

public EventData (System.IO.Stream stream);
new Microsoft.ServiceBus.Messaging.EventData : System.IO.Stream -> Microsoft.ServiceBus.Messaging.EventData
Public Sub New (stream As Stream)

Parameters

stream
Stream

A stream which is used as the body stream.

Remarks

User is expected to own the disposing of the stream when using this constructor.

Applies to

EventData(Object, XmlObjectSerializer)

Constructor which takes the input content and serializer to create the body stream.

public EventData (object content, System.Runtime.Serialization.XmlObjectSerializer serializer);
new Microsoft.ServiceBus.Messaging.EventData : obj * System.Runtime.Serialization.XmlObjectSerializer -> Microsoft.ServiceBus.Messaging.EventData
Public Sub New (content As Object, serializer As XmlObjectSerializer)

Parameters

content
Object

.Net object

serializer
XmlObjectSerializer

the serializer used to serialize content

Remarks

If content is a stream and seriazlier is null, then it is equate to use EventData(Stream)

Applies to