protobuf-net
Pushes a null reference onto the stack. Note that this should only
be used to return a null (or set a variable to null); for null-tests
use BranchIfTrue / BranchIfFalse.
Creates a new "using" block (equivalent) around a variable;
the variable must exist, and note that (unlike in C#) it is
the variables *final* value that gets disposed. If you need
*original* disposal, copy your variable first.
It is the callers responsibility to ensure that the variable's
scope fully-encapsulates the "using"; if not, the variable
may be re-used (and thus re-assigned) unexpectedly.
The type that this serializer is intended to work for.
Perform the steps necessary to serialize this data.
The value to be serialized.
Writer state
Perform the steps necessary to deserialize this data.
The current value, if appropriate.
Reader state
The updated / replacement value.
Indicates whether a Read operation replaces the existing value, or
extends the value. If false, the "value" parameter to Read is
discarded, and should be passed in as null.
Not all Read operations return a value (although most do); if false no
value should be expected.
Emit the IL necessary to perform the given actions
to serialize this data.
Details and utilities for the method being generated.
The source of the data to work against;
If the value is only needed once, then LoadValue is sufficient. If
the value is needed multiple times, then note that a "null"
means "the top of the stack", in which case you should create your
own copy - GetLocalWithValue.
Emit the IL necessary to perform the given actions to deserialize this data.
Details and utilities for the method being generated.
For nested values, the instance holding the values; note
that this is not always provided - a null means not supplied. Since this is always
a variable or argument, it is not necessary to consume this value.
A type model that performs per-assembly auto-compilation
Create a model that serializes all types from an
assembly specified by type
Create a model that serializes all types from an
assembly specified by type
Create a model that serializes all types from an assembly
Create a model that serializes all types from an assembly
Gets the instance of this serializer
Represents the set of serialization callbacks to be used when serializing/deserializing a type.
Called before serializing an instance
Called before deserializing an instance
Called after serializing an instance
Called after deserializing an instance
True if any callback is set, else False
Describes a named constant integer, i.e. an enum value
Gets the declared name of this enum member
Gets the value of this enum member
Create a new named enum value; the value can be of the expected
enum type, or an appropriate boxed enum value
Creates a copy of this definition with a different name
Creates a copy of this definition with a different value
Converts the declared value in accordance with the provided type
Compare a member to an enum value
Compare two enum-member definitions
Indicates whether two values are considered equal.
Indicates whether two values are considered equal.
Create an EnumMember instance from an enum value
Represents a type at runtime for use with protobuf, allowing the field mappings (etc) to be defined
Get the name of the type being represented
Gets the base-type for this type
Gets or sets the for this instance
When used to compile a model, should public serialization/deserialzation methods
be included for this type?
Should this type be treated as a reference by default?
Adds a known sub-type to the inheritance model
Adds a known sub-type to the inheritance model
Indicates whether the current type has defined callbacks
Indicates whether the current type has defined subtypes
Returns the set of callbacks defined for this type
Assigns the callbacks to use during serialiation/deserialization.
The method (or null) called before serialization begins.
The method (or null) called when serialization is complete.
The method (or null) called before deserialization begins (or when a new instance is created during deserialization).
The method (or null) called when deserialization is complete.
The set of callbacks.
Assigns the callbacks to use during serialiation/deserialization.
The name of the method (or null) called before serialization begins.
The name of the method (or null) called when serialization is complete.
The name of the method (or null) called before deserialization begins (or when a new instance is created during deserialization).
The name of the method (or null) called when deserialization is complete.
The set of callbacks.
Returns the public Type name of this Type used in serialization
Gets or sets the name of this contract.
Gets or sets the file that defines this type (as used with import in .proto)
Designate a factory-method to use to create instances of this type
Designate a factory-method to use to create instances of this type
Throws an exception if the type has been made immutable
The runtime type that the meta-type represents
Adds a member (by name) to the MetaType
Adds a member (by name) to the MetaType, returning the ValueMember rather than the fluent API.
This is otherwise identical to Add.
Gets or sets whether the type should use a parameterless constructor (the default),
or whether the type should skip the constructor completely. This option is not supported
on compact-framework.
The concrete type to create when a new instance of this type is needed; this may be useful when dealing
with dynamic proxies, or with interface-based APIs
Adds a member (by name) to the MetaType
Performs serialization of this type via a surrogate; all
other serialization options are ignored and handled
by the surrogate's configuration.
Adds a set of members (by name) to the MetaType
Adds a member (by name) to the MetaType
Adds a member (by name) to the MetaType, including an itemType and defaultType for representing lists
Adds a member (by name) to the MetaType, including an itemType and defaultType for representing lists, returning the ValueMember rather than the fluent API.
This is otherwise identical to Add.
Returns the ValueMember that matchs a given field number, or null if not found
Returns the ValueMember that matchs a given member (property/field), or null if not found
Returns the ValueMember instances associated with this type
Returns the EnumMember instances associated with this type
Add a new defined name/value pair for an enum
Returns the SubType instances associated with this type
Compiles the serializer for this type; this is *not* a full
standalone compile, but can significantly boost performance
while allowing additional types to be added.
An in-place compile can access non-public types / members
Gets or sets a value indicating that an enum should be treated directly as an int/short/etc, rather
than enforcing .proto enum rules. This is useful *in particul* for [Flags] enums.
Gets or sets a value indicating that this type should NOT be treated as a list, even if it has
familiar list-like characteristics (enumerable, add, etc)
Gets or sets a value indicating whether unknown sub-types should cause serialization failure
Specify a custom serializer for this type
Indicates whether this type should always be treated as a "group" (rather than a string-prefixed sub-message)
Apply a shift to all fields (and sub-types) on this type
The change in field number to apply
The resultant field numbers must still all be considered valid
Adds a single number field reservation
Adds range number field reservation
Adds a named field reservation
Provides protobuf serialization support for a number of types that can be defined at runtime
Ensures that RuntimeTypeModel has been initialized, in advance of using methods on .
Specifies optional behaviors associated with this model
Global default that
enables/disables automatic tag generation based on the existing name / order
of the defined members. See
for usage and important warning / explanation.
You must set the global default before attempting to serialize/deserialize any
impacted type.
Global default that determines whether types are considered serializable
if they have [DataContract] / [XmlType]. With this enabled, ONLY
types marked as [ProtoContract] are added automatically.
Global switch that enables or disables the implicit
handling of "zero defaults"; meanning: if no other default is specified,
it assumes bools always default to false, integers to zero, etc.
If this is disabled, no such assumptions are made and only *explicit*
default values are processed. This is enabled by default to
preserve similar logic to v1.
Global switch that determines whether types with a .ToString() and a Parse(string)
should be serialized as strings.
Global switch that determines whether DateTime serialization should include the Kind of the date/time.
Should zero-length packed arrays be serialized? (this is the v2 behavior, but skipping them is more efficient)
Should root-values allow "packed" encoding? (v2 does not support this)
Global switch that determines whether a single instance of the same string should be used during deserialization.
Note this does not use the global .NET string interner
The default model, used to support ProtoBuf.Serializer
Returns a sequence of the Type instances that can be
processed by this model.
Gets or sets the default for this model.
Obtains the MetaType associated with a given Type for the current model,
allowing additional configuration.
Like the non-generic Add(Type); for convenience
Adds support for an additional type in this model, optionally
applying inbuilt patterns. If the type is already known to the
model, the existing type is returned **without** applying
any additional behaviour.
Inbuilt patterns include:
[ProtoContract]/[ProtoMember(n)]
[DataContract]/[DataMember(Order=n)]
[XmlType]/[XmlElement(Order=n)]
[On{Des|S}erializ{ing|ed}]
ShouldSerialize*/*Specified
The type to be supported
Whether to apply the inbuilt configuration patterns (via attributes etc), or
just add the type with no additional configuration (the type must then be manually configured).
The MetaType representing this type, allowing
further configuration.
Adds support for an additional type in this model, optionally
applying inbuilt patterns. If the type is already known to the
model, the existing type is returned **without** applying
any additional behaviour.
Inbuilt patterns include:
[ProtoContract]/[ProtoMember(n)]
[DataContract]/[DataMember(Order=n)]
[XmlType]/[XmlElement(Order=n)]
[On{Des|S}erializ{ing|ed}]
ShouldSerialize*/*Specified
The type to be supported
Whether to apply the inbuilt configuration patterns (via attributes etc), or
just add the type with no additional configuration (the type must then be manually configured).
The to assume for this type; this should usually be omitted
The MetaType representing this type, allowing
further configuration.
Raised before a type is auto-configured; this allows the auto-configuration to be electively suppressed
This callback should be fast and not involve complex external calls, as it may block the model
Raised after a type is auto-configured; this allows additional external customizations
This callback should be fast and not involve complex external calls, as it may block the model
Should serializers be compiled on demand? It may be useful
to disable this for debugging purposes.
Should support for unexpected types be added automatically?
If false, an exception is thrown when unexpected types
are encountered.
Verifies that the model is still open to changes; if not, an exception is thrown
Prevents further changes to this model
Resolve a service relative to T
Indicates whether a type is known to the model
See Object.ToString
Compiles the serializers individually; this is *not* a full
standalone compile, but can significantly boost performance
while allowing additional types to be added.
An in-place compile can access non-public types / members
Represents configuration options for compiling a model to
a standalone assembly.
Import framework options from an existing type
The TargetFrameworkAttribute FrameworkName value to burn into the generated assembly
The TargetFrameworkAttribute FrameworkDisplayName value to burn into the generated assembly
The name of the TypeModel class to create
The path for the new dll
The runtime version for the generated assembly
The runtime version for the generated assembly
The Version baked into the generated assembly.
The acecssibility of the generated serializer
Implements a filter for use when generating models from assemblies
Type accessibility
Available to all callers
Available to all callers in the same assembly, or assemblies specified via [InternalsVisibleTo(...)]
Fully compiles the current model into a static-compiled serialization dll
(the serialization dll still requires protobuf-net for support services).
A full compilation is restricted to accessing public types / members
The name of the TypeModel class to create
The path for the new dll
An instance of the newly created compiled type-model
Fully compiles the current model into a static-compiled serialization dll
(the serialization dll still requires protobuf-net for support services).
A full compilation is restricted to accessing public types / members
An instance of the newly created compiled type-model
The amount of time to wait if there are concurrent metadata access operations
If a lock-contention is detected, this event signals the *owner* of the lock responsible for the blockage, indicating
what caused the problem; this is only raised if the lock-owning code successfully completes.
Designate a factory-method to use to create instances of any type; note that this only affect types seen by the serializer *after* setting the factory.
Creates a new runtime model, to which the caller
can add support for a range of types. A model
can be used "as is", or can be compiled for
optimal performance.
The logical name of this model
Create a model that serializes all types from an
assembly specified by type
Create a model that serializes all types from an
assembly specified by type
Create a model that serializes all types from an assembly
Promotes this model instance to be the default model; the default model is used by and .
Treat all values of (non-serializable)
as though they were the surrogate (serializable);
if custom conversion operators are provided, they are used in place of implicit
or explicit conversion operators.
The non-serializable type to provide custom support for
The serializable type that should be used instead
Custom conversion operation
Custom conversion operation
The to use
The to assume for this type
The original model (for chaining).
Add an externally defined serialiser
type of the collectionn e.g. F# Map
type of the External Serializer
Contains the stack-trace of the owning code when a lock-contention scenario is detected
The stack-trace of the code that owned the lock when a lock-contention scenario occurred
Event-type that is raised when a lock-contention scenario is detected
Represents an inherited type in a type hierarchy.
The field-number that is used to encapsulate the data (as a nested
message) for the derived dype.
The sub-type to be considered.
Creates a new SubType instance.
The field-number that is used to encapsulate the data (as a nested
message) for the derived dype.
The sub-type to be considered.
Specific encoding style to use; in particular, Grouped can be used to avoid buffering, but is not the default.
Event data associated with new types being added to a model
Whether or not to apply the default mapping behavior
The configuration of the type being added
The type that was added to the model
The model that is being changed
Represents a member (property/field) that is mapped to a protobuf field
The number that identifies this member in a protobuf stream
Gets the member (field/property) which this member relates to.
Gets the backing member (field/property) which this member relates to
Within a list / array / etc, the type of object for each item in the list (especially useful with ArrayList)
The underlying type of the member
For abstract types (IList etc), the type of concrete object to create (if required)
The type the defines the member
The default value of the item (members with this value will not be serialized)
Gets or sets the of this member; by default this is inherited from
the type; when is used with ,
the member is considered .
Creates a new ValueMember instance
Creates a new ValueMember instance
Specifies the rules used to process the field; this is used to determine the most appropriate
wite-type, but also to describe subtypes within that wire-type (such as SignedVariant)
Indicates whether this field should follow strict encoding rules; this means (for example) that if a "fixed32"
is encountered when "variant" is defined, then it will fail (throw an exception) when parsing. Note that
when serializing the defined type is always used.
Indicates whether this field should use packed encoding (which can save lots of space for repeated primitive values).
This option only applies to list/array data of primitive types (int, double, etc).
Indicates whether this field should *replace* existing values (the default is false, meaning *append*).
This option only applies to list/array data.
Indicates whether this field is mandatory.
Enables full object-tracking/full-graph support.
Embeds the type information into the stream, allowing usage with types not known in advance.
Indicates that the member should be treated as a protobuf Map
Specifies the data-format that should be used for the key, when IsMap is enabled
Specifies the data-format that should be used for the value, when IsMap is enabled
Specifies methods for working with optional data members.
Provides a method (null for none) to query whether this member should
be serialized; it must be of the form "bool {Method}()". The member is only serialized if the
method returns true.
Provides a method (null for none) to indicate that a member was
deserialized; it must be of the form "void {Method}(bool)", and will be called with "true"
when data is found.
Gets the logical name for this member in the schema (this is not critical for binary serialization, but may be used
when inferring a schema).
Should lists have extended support for null values? Note this makes the serialization less efficient.
Provides protocol-buffer serialization capability for concrete, attributed types. This
is a *default* model, but custom serializer models are also supported.
Protocol-buffer serialization is a compact binary format, designed to take
advantage of sparse data and knowledge of specific data types; it is also
extensible, allowing a type to be deserialized / merged even if some data is
not recognised.
Suggest a .proto definition for the given type
The type to generate a .proto definition for
The .proto definition as a string
Suggest a .proto definition for the given type
The type to generate a .proto definition for
The .proto definition as a string
Suggest a .proto definition for the given type
The .proto definition as a string
Create a deep clone of the supplied instance; any sub-items are also cloned.
Create a deep clone of the supplied instance; any sub-items are also cloned.
Calculates the length of a protocol-buffer payload for an item
Applies a protocol-buffer stream to an existing instance.
The type being merged.
The existing instance to be modified (can be null).
The binary stream to apply to the instance (cannot be null).
The updated instance; this may be different to the instance argument if
either the original instance was null, or the stream defines a known sub-type of the
original instance.
Serializes a given instance and deserializes it as a different type;
this can be used to translate between wire-compatible objects (where
two .NET types represent the same data), or to promote/demote a type
through an inheritance hierarchy.
No assumption of compatibility is made between the types.
The type of the object being copied.
The type of the new object to be created.
The existing instance to use as a template.
A new instane of type TNewType, with the data from TOldType.
Applies a protocol-buffer from an XmlReader to an existing instance.
The type being merged.
The existing instance to be modified (cannot be null).
The XmlReader containing the data to apply to the instance (cannot be null).
Applies a protocol-buffer from a SerializationInfo to an existing instance.
The type being merged.
The existing instance to be modified (cannot be null).
The SerializationInfo containing the data to apply to the instance (cannot be null).
Applies a protocol-buffer from a SerializationInfo to an existing instance.
The type being merged.
The existing instance to be modified (cannot be null).
The SerializationInfo containing the data to apply to the instance (cannot be null).
Additional information about this serialization operation.
Precompiles the serializer for a given type.
Creates a new IFormatter that uses protocol-buffer [de]serialization.
The type of object to be [de]deserialized by the formatter.
A new IFormatter to be used during [de]serialization.
Reads a sequence of consecutive length-prefixed items from a stream, using
either base-128 or fixed-length prefixes. Base-128 prefixes with a tag
are directly comparable to serializing multiple items in succession
(use the tag to emulate the implicit behavior
when serializing a list/array). When a tag is
specified, any records with different tags are silently omitted. The
tag is ignored. The tag is ignored for fixed-length prefixes.
The type of object to deserialize.
The binary stream containing the serialized records.
The prefix style used in the data.
The tag of records to return (if non-positive, then no tag is
expected and all records are returned).
The sequence of deserialized objects.
Creates a new instance from a protocol-buffer stream that has a length-prefix
on data (to assist with network IO).
The type to be created.
The binary stream to apply to the new instance (cannot be null).
How to encode the length prefix.
A new, initialized instance.
Creates a new instance from a protocol-buffer stream that has a length-prefix
on data (to assist with network IO).
The type to be created.
The binary stream to apply to the new instance (cannot be null).
How to encode the length prefix.
The expected tag of the item (only used with base-128 prefix style).
A new, initialized instance.
Applies a protocol-buffer stream to an existing instance, using length-prefixed
data - useful with network IO.
The type being merged.
The existing instance to be modified (can be null).
The binary stream to apply to the instance (cannot be null).
How to encode the length prefix.
The updated instance; this may be different to the instance argument if
either the original instance was null, or the stream defines a known sub-type of the
original instance.
Indicates the number of bytes expected for the next message.
The stream containing the data to investigate for a length.
The algorithm used to encode the length.
The length of the message, if it could be identified.
True if a length could be obtained, false otherwise.
Indicates the number of bytes expected for the next message.
The buffer containing the data to investigate for a length.
The offset of the first byte to read from the buffer.
The number of bytes to read from the buffer.
The algorithm used to encode the length.
The length of the message, if it could be identified.
True if a length could be obtained, false otherwise.
The field number that is used as a default when serializing/deserializing a list of objects.
The data is treated as repeated message with field number 1.
Provides non-generic access to the default serializer.
Create a deep clone of the supplied instance; any sub-items are also cloned.
Writes a protocol-buffer representation of the given instance to the supplied stream.
The existing instance to be serialized (cannot be null).
The destination stream to write to.
Creates a new instance from a protocol-buffer stream
The type to be created.
The binary stream to apply to the new instance (cannot be null).
A new, initialized instance.
Creates a new instance from a protocol-buffer stream
Creates a new instance from a protocol-buffer stream
Creates a new instance from a protocol-buffer stream
Creates a new instance from a protocol-buffer stream
Applies a protocol-buffer stream to an existing instance.
The existing instance to be modified (cannot be null).
The binary stream to apply to the instance (cannot be null).
The updated instance
Writes a protocol-buffer representation of the given instance to the supplied stream,
with a length-prefix. This is useful for socket programming,
as DeserializeWithLengthPrefix/MergeWithLengthPrefix can be used to read the single object back
from an ongoing stream.
The existing instance to be serialized (cannot be null).
How to encode the length prefix.
The destination stream to write to.
The tag used as a prefix to each record (only used with base-128 style prefixes).
Applies a protocol-buffer stream to an existing instance (or null), using length-prefixed
data - useful with network IO.
The existing instance to be modified (can be null).
The binary stream to apply to the instance (cannot be null).
How to encode the length prefix.
Used to resolve types on a per-field basis.
The updated instance; this may be different to the instance argument if
either the original instance was null, or the stream defines a known sub-type of the
original instance.
Indicates whether the supplied type is explicitly modelled by the model
Precompiles the serializer for a given type.
Global switches that change the behavior of protobuf-net
Gets or sets the default .proto syntax to be used
Releases any internal buffers that have been reserved for efficiency; this does not affect any serialization
operations; simply: it can be used (optionally) to release the buffers for garbage collection (at the expense
of having to re-allocate a new buffer for the next operation, rather than re-use prior buffers).
Maps a field-number to a type
Creates a new instance from a protocol-buffer stream
The type to be created.
The binary stream to apply to the new instance (cannot be null).
A new, initialized instance.
Creates a new instance from a protocol-buffer stream
The type to be created.
A new, initialized instance.
Creates a new instance from a protocol-buffer stream
The type to be created.
A new, initialized instance.
Creates a new instance from a protocol-buffer stream
The type to be created.
The binary stream to apply to the new instance (cannot be null).
A new, initialized instance.
Creates a new instance from a protocol-buffer stream
Creates a new instance from a protocol-buffer stream
Creates a new instance from a protocol-buffer stream
Writes a protocol-buffer representation of the given instance to the supplied stream.
The existing instance to be serialized (cannot be null).
The destination stream to write to.
Writes a protocol-buffer representation of the given instance to the supplied stream.
The existing instance to be serialized (cannot be null).
The destination stream to write to.
Additional state for this serialization operation
Writes a protocol-buffer representation of the given instance to the supplied writer.
The existing instance to be serialized (cannot be null).
The destination stream to write to.
Additional serialization context
Writes a protocol-buffer representation of the given instance to the supplied SerializationInfo.
The type being serialized.
The existing instance to be serialized (cannot be null).
The destination SerializationInfo to write to.
Writes a protocol-buffer representation of the given instance to the supplied SerializationInfo.
The type being serialized.
The existing instance to be serialized (cannot be null).
The destination SerializationInfo to write to.
Additional information about this serialization operation.
Writes a protocol-buffer representation of the given instance to the supplied XmlWriter.
The type being serialized.
The existing instance to be serialized (cannot be null).
The destination XmlWriter to write to.
Writes a protocol-buffer representation of the given instance to the supplied stream,
with a length-prefix. This is useful for socket programming,
as DeserializeWithLengthPrefix/MergeWithLengthPrefix can be used to read the single object back
from an ongoing stream.
The type being serialized.
The existing instance to be serialized (cannot be null).
How to encode the length prefix.
The destination stream to write to.
Writes a protocol-buffer representation of the given instance to the supplied stream,
with a length-prefix. This is useful for socket programming,
as DeserializeWithLengthPrefix/MergeWithLengthPrefix can be used to read the single object back
from an ongoing stream.
The type being serialized.
The existing instance to be serialized (cannot be null).
How to encode the length prefix.
The destination stream to write to.
The tag used as a prefix to each record (only used with base-128 style prefixes).