Difference between revisions of "Dice/RollResult/InvalidRoll"

From DiceRoller Documentation
(Created page with "{{APIdoc|RollResult.InvalidRoll Field}} This RollResult is used as a placeholder whenever an invalid roll is added to a {{l|Dice.PbP.RollPost|RollPost}}. {{ns}} == Syntax ==...")
 
 
Line 15: Line 15:
  
 
== Remarks ==
 
== Remarks ==
This is a sentinel value used for invalid rolls. You can test if a given roll is invalid by using the {{cs|==}} operator. For example, {{cs|myRoll == RollResult.InvalidRoll}}. Do not attempt to compare using reference equality, as a deserialized RollResult may be an invalid roll but will be a different object (in memory) than RollResult.InvalidRoll. In other words, ensure that both sides of the equality comparison are cast to RollResult before executing the check.
+
This is a sentinel value used for invalid rolls. You can test if a given roll is invalid by using the {{cs|1===}} operator. For example, {{cs|1=myRoll == RollResult.InvalidRoll}}. Do not attempt to compare using reference equality, as a deserialized RollResult may be an invalid roll but will be a different object (in memory) than RollResult.InvalidRoll. In other words, ensure that both sides of the equality comparison are cast to RollResult before executing the check.

Latest revision as of 22:02, 15 September 2017

This RollResult is used as a placeholder whenever an invalid roll is added to a RollPost.

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

Syntax

public static readonly RollResult InvalidRoll

Field Value

Type: Dice.RollResult

The placeholder result indicating an invalid roll.

Remarks

This is a sentinel value used for invalid rolls. You can test if a given roll is invalid by using the == operator. For example, myRoll == RollResult.InvalidRoll. Do not attempt to compare using reference equality, as a deserialized RollResult may be an invalid roll but will be a different object (in memory) than RollResult.InvalidRoll. In other words, ensure that both sides of the equality comparison are cast to RollResult before executing the check.