SerializationWriterWriteOptimized Method (String) |
Writes a string value into the stream using the fewest number of bytes possible.
Stored Size: 1 byte upwards depending on string length
Notes:
Encodes null, Empty, 'Y', 'N', ' ' values as a single byte
Any other single char string is stored as two bytes
All other strings are stored in a string token list:
The TypeCode representing the current string token list is written first (1 byte),
followed by the string token itself (1-4 bytes)
When the current string list has reached 128 values then a new string list
is generated and that is used for generating future string tokens. This continues
until the maximum number (128) of string lists is in use, after which the string
lists are used in a round-robin fashion.
By doing this, more lists are created with fewer items which allows a smaller
token size to be used for more strings.
The first 16,384 strings will use a 1 byte token.
The next 2,097,152 strings will use a 2 byte token. (This should suffice for most uses!)
The next 268,435,456 strings will use a 3 byte token. (My, that is a lot!!)
The next 34,359,738,368 strings will use a 4 byte token. (only shown for completeness!!!)
Namespace:
SD.LLBLGen.Pro.ORMSupportClasses
Assembly:
SD.LLBLGen.Pro.ORMSupportClasses (in SD.LLBLGen.Pro.ORMSupportClasses.dll) Version: 5.9.0.0 (5.9.0)
Syntax public void WriteOptimized(
string value
)
Public Sub WriteOptimized (
value As String
)
Parameters
- value
- Type: SystemString
The string to store.
See Also