Enhanced C#
Loyc library documentation
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
Public fields | Public Member Functions | List of all members
DynamicSync< SM, T > Struct Template Reference

A synchronizer for dynamically-typed (polymorphic) fields: when writing, the runtime type of the value selects a synchronizer from a TypeSyncRegistry and its type tag (from a TypeTagRegistry) is recorded; when reading, the type tag read from the data stream selects the synchronizer. Being an ordinary ISyncField{SM, T}, it composes with the list/collection helpers (e.g. as the item synchronizer of a list). More...


Source file:
Inheritance diagram for DynamicSync< SM, T >:

Remarks

A synchronizer for dynamically-typed (polymorphic) fields: when writing, the runtime type of the value selects a synchronizer from a TypeSyncRegistry and its type tag (from a TypeTagRegistry) is recorded; when reading, the type tag read from the data stream selects the synchronizer. Being an ordinary ISyncField{SM, T}, it composes with the list/collection helpers (e.g. as the item synchronizer of a list).

By default the ambient services (TypeSyncRegistry.Default and TypeTagRegistry.Default) are consulted on every call; the two-argument constructor binds specific instances instead. See also: SyncDynamicExt.SyncDyn{SM, T}(SM, FieldId, T, ObjectMode).

Type Constraints
SM :ISyncManager 

Public fields

ObjectMode _mode
 
TypeSyncRegistry _synchronizers
 
TypeTagRegistry _tags
 

Public Member Functions

 DynamicSync (ObjectMode mode)
 
 DynamicSync (TypeSyncRegistry synchronizers, TypeTagRegistry?tags=null, ObjectMode mode=ObjectMode.Deduplicate)
 Binds this synchronizer to specific registry instances instead of the ambient (async-local) defaults. This is useful when different data streams need different registrations at the same time, and avoids any dependence on thread identity (e.g. across await points). More...
 
T Sync (ref SM sync, FieldId name, T?value)
 

Constructor & Destructor Documentation

DynamicSync< SM, T >.DynamicSync ( TypeSyncRegistry  synchronizers,
TypeTagRegistry?  tags = null,
ObjectMode  mode = ObjectMode.Deduplicate 
)
inline

Binds this synchronizer to specific registry instances instead of the ambient (async-local) defaults. This is useful when different data streams need different registrations at the same time, and avoids any dependence on thread identity (e.g. across await points).