Show / Hide Table of Contents

# Class BinaryReflectiveSerializer

Binary serializer which reflectively writes all fields except of ones with System.NonSerializedAttribute.

Note that Java platform stores dates as a difference between current time and predefined absolute UTC date. Therefore, this difference is always the same for all time zones. .NET, in contrast, stores dates as a difference between current time and some predefined date relative to the current time zone. It means that this difference will be different as you change time zones. To overcome this discrepancy Ignite always converts .Net date to UTC form before serializing and allows user to decide whether to deserialize them in UTC or local form using `ReadTimestamp(..., true/false)` methods in IBinaryReader and IBinaryRawReader. This serializer always read dates in UTC form. It means that if you have local date in any field/property, it will be implicitly converted to UTC form after the first serialization-deserialization cycle.

##### Inheritance

System.Object
BinaryReflectiveSerializer

##### Implements

IBinarySerializer

##### Inherited Members

System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()

###### Namespace: Apache.Ignite.Core.Binary

###### Assembly: Apache.Ignite.Core.dll

##### Syntax

    public sealed class BinaryReflectiveSerializer : IBinarySerializer

### Properties

#### ForceTimestamp

Gets or sets a value indicating whether all DateTime values should be written as Timestamp.

Timestamp format is required for values used in SQL and for interoperation with other platforms. Only UTC values are supported in Timestamp format. Other values will cause an exception on write.

Normally serializer uses WriteObject<T>(String, T) for DateTime fields. This attribute changes the behavior to WriteTimestamp(String, Nullable<DateTime>).

See also TimestampAttribute.

##### Declaration

    public bool ForceTimestamp { get; set; }

##### Property Value

Type | Description
--- | ---
System.Boolean |

#### RawMode

Gets or value indicating whether raw mode serialization should be used.

Raw mode does not include field names, improving performance and memory usage. However, queries do not support raw objects.

##### Declaration

    public bool RawMode { get; set; }

##### Property Value

Type | Description
--- | ---
System.Boolean |

### Methods

#### ReadBinary(Object, IBinaryReader)

Read binary object.

##### Declaration

    public void ReadBinary(object obj, IBinaryReader reader)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Object | obj | Instantiated empty object.
IBinaryReader | reader | Binary reader.

#### WriteBinary(Object, IBinaryWriter)

Write binary object.

##### Declaration

    public void WriteBinary(object obj, IBinaryWriter writer)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Object | obj | Object.
IBinaryWriter | writer | Binary writer.

### Implements

IBinarySerializer