Click or drag to resize

SerializationWriterWriteObject Method

Stores an object into the stream using the fewest number of bytes possible. Stored Size: 1 byte upwards depending on type and/or content. 1 byte: null, DBNull.Value, Boolean 1 to 2 bytes: Int16, UInt16, Byte, SByte, Char, 1 to 4 bytes: Int32, UInt32, Single, BitVector32 1 to 8 bytes: DateTime, TimeSpan, Double, Int64, UInt64 1 or 16 bytes: Guid 1 plus content: string, object[], byte[], char[], BitArray, Type, ArrayList Any other object be stored using a .Net Binary formatter but this should only be allowed as a last resort: Since this is effectively a different serialization session, there is a possibility of the same shared object being serialized twice or, if the object has a reference directly or indirectly back to the parent object, there is a risk of looping which will throw an exception. The type of object is checked with the most common types being checked first. Each 'section' can be reordered to provide optimum speed but the check for null should always be first and the default serialization always last. Once the type is identified, a SerializedType byte is stored in the stream followed by the data for the object (certain types/values may not require storage of data as the SerializedType may imply the value). For certain objects, if the value is within a certain range then optimized storage may be used. If the value doesn't meet the required optimization criteria then the value is stored directly. The checks for optimization may be disabled by setting the OptimizeForSize property to false in which case the value is stored directly. This could result in a slightly larger stream but there will be a speed increate to compensate.

Namespace:  SD.LLBLGen.Pro.ORMSupportClasses
Assembly:  SD.LLBLGen.Pro.ORMSupportClasses (in SD.LLBLGen.Pro.ORMSupportClasses.dll) Version: 5.5.0.0 (5.5.18.1019)
Syntax
public void WriteObject(
	Object value
)

Parameters

value
Type: SystemObject
The object to store.
See Also