< Dice‎ | PbP‎ | RollPost

Difference between revisions of "Dice/PbP/RollPost/Serialize"

From DiceRoller Documentation
 
Line 18: Line 18:
 
== Remarks ==
 
== Remarks ==
 
This method should be used whenever serializing a RollPost for persistent storage. It will serialize Pristine and Stored, but leave Current empty (note that Current is written into Stored when [[../Validate|Validate()]] is called).
 
This method should be used whenever serializing a RollPost for persistent storage. It will serialize Pristine and Stored, but leave Current empty (note that Current is written into Stored when [[../Validate|Validate()]] is called).
 +
 +
As a result of this, Validate() must be called on a RollPost before Serialize is called, or else it will not serialize anything (or will serialize old data).
  
 
== See Also ==
 
== See Also ==
 
The [[../|RollPost class documentation]] contains an example using Serialize() to store data into a database.
 
The [[../|RollPost class documentation]] contains an example using Serialize() to store data into a database.

Latest revision as of 16:59, 5 October 2017

Serializes a RollPost, for saving to the database.

  • Namespace: Dice.PbP
  • Assembly: DiceRoller (in DiceRoller.dll)

Syntax

public void Serialize(
    Stream serializationStream
)

Parameters

serializationStream
Type: System.IO.Stream
The stream to write serialized data to.

Remarks

This method should be used whenever serializing a RollPost for persistent storage. It will serialize Pristine and Stored, but leave Current empty (note that Current is written into Stored when Validate() is called).

As a result of this, Validate() must be called on a RollPost before Serialize is called, or else it will not serialize anything (or will serialize old data).

See Also

The RollPost class documentation contains an example using Serialize() to store data into a database.