< Dice‎ | Roller
Revision as of 19:27, 13 April 2017 by Skizzerz (talk | contribs) (Created page with "{{APIdoc|Roller.Roll Method (String)}} Rolls dice according to the given dice expression. Please see Dice Reference for more information about dice expressions. {{ns}} =...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Roller.Roll Method (String)

From DiceRoller Documentation

Rolls dice according to the given dice expression. Please see Dice Reference for more information about dice expressions.

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

Syntax

public static RollResult Roll(
    string diceExpr
)

Parameters

diceExpr
Type: System.String
A dice expression.

Return value

Type: Dice.RollResult

The result of rolling diceExpr.

Exceptions

Exception Condition
ArgumentNullException diceExpr is null.
DiceException An error was detected with diceExpr.

When a DiceException is thrown, the exception will contain an ErrorCode property which describes the error in more detail.

Remarks

This is equivalent to calling Roller.Roll(String, RollerConfig) with a null value for config. See the Roll overload page for more details.

Example

RollResult result = Roller.Roll("1d20+4");
Console.WriteLine(result.Value);