< Dice‎ | PbP‎ | RollPost

RollPost._stored Field

From DiceRoller Documentation

Backing field for Stored/StoredList.

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

Syntax

private List<RollResult> _stored;

Field Value

Type: System.Collections.Generic.List<Dice.RollResult>

Backing field for Stored/StoredList. Initialized to an empty list in the default constructor. When deserializing, this is an empty list until OnDeserialization is called, at which point it will be filled out.

StoredList is directly initialized to the deserialized RollResult[] array in the deserializing constructor, and that is converted into a List<RollResult> in OnDeserialization. In that callback, StoredList is then set to _stored rather than directly storing the array. This is done because the array is deserialized before array elements, so at the time of the deserialization constructor all elements in the array are null. It is not until OnDeserialization is called that the array elements are filled in, and if it is converted to a List first, the nulls will never be replaced with their proper values.