Edit

Share via


Immutable<T> Struct

Definition

Wrapper class for carrying immutable data.

public struct Immutable<T>
[Orleans.GenerateSerializer]
[Orleans.Immutable]
public readonly struct Immutable<T>
type Immutable<'T> = struct
[<Orleans.GenerateSerializer>]
[<Orleans.Immutable>]
type Immutable<'T> = struct
Public Structure Immutable(Of T)

Type Parameters

T

Type of data to be wrapped by this Immutable

Inheritance
Immutable<T>
Attributes

Remarks

Objects that are known to be immutable are given special fast-path handling by the Orleans serializer -- which in a nutshell allows the DeepCopy step to be skipped during message sends where the sender and receiver grain are in the same silo.

One very common usage pattern for Immutable is when passing byte[] parameters to a grain. If a program knows it will not alter the contents of the byte[] (for example, if it contains bytes from a static image file read from disk) then considerable savings in memory usage and message throughput can be obtained by marking that byte[] argument as Immutable.

Constructors

Immutable<T>(T)

Constructor to wrap the specified data object in new Immutable wrapper.

Fields

Value

Return reference to the original value stored in this Immutable wrapper.

Properties

Value

Return reference to the original value stored in this Immutable wrapper.

Applies to