Skip to content

Immutable<T>

struct

Namespace: Orleans.Concurrency

Wrapper class for carrying immutable data.
[Orleans.GenerateSerializer]
[Orleans.Immutable]
public readonly struct Immutable<T>

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.