< Dice‎ | PbP‎ | RollPost
Revision as of 18:32, 1 May 2017 by Skizzerz (talk | contribs) (Created page with "{{APIdoc|RollPost._stored Field}} Backing field for Stored/StoredList. {{ns}} == Syntax == <syntaxhighlight lang="C#"> private List<RollResult> _stored; </syntaxhighlight>...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

RollPost._stored Field

From DiceRoller Documentation

Backing field for Stored/StoredList.

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

Syntax

private List<RollResult> _stored;

Property 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.