Difference between revisions of "Dice/Roller/Roll (String, RollerConfig)"
From DiceRoller Documentation
(Created page with "Rolls dice according to the given dice expression. Please see Dice Reference for more information about dice expressions. __NOTOC__ == Syntax == <syntaxhighlight lang="C#"...") |
|||
(10 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | {{APIdoc|Roller.Roll Method (String, RollerConfig)}} | ||
Rolls dice according to the given dice expression. Please see [[Dice Reference]] for more information about dice expressions. | Rolls dice according to the given dice expression. Please see [[Dice Reference]] for more information about dice expressions. | ||
− | + | ||
+ | {{ns}} | ||
+ | |||
== Syntax == | == Syntax == | ||
<syntaxhighlight lang="C#"> | <syntaxhighlight lang="C#"> | ||
public static RollResult Roll( | public static RollResult Roll( | ||
− | string diceExpr | + | string diceExpr, |
+ | RollerConfig config | ||
) | ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 12: | Line 16: | ||
: Type: System.String | : Type: System.String | ||
: A [[Dice Reference|dice expression]]. | : A [[Dice Reference|dice expression]]. | ||
+ | ; ''config'' | ||
+ | : Type: [[Dice/RollerConfig|Dice.RollerConfig]] | ||
+ | : Configuration to use for this roll. If {{cs|null}}, the [[Dice/Roller/DefaultConfig|DefaultConfig]] will be used. | ||
=== Return value === | === Return value === | ||
− | Type: [[ | + | Type: [[Dice/RollResult|Dice.RollResult]] |
The result of rolling ''diceExpr''. | The result of rolling ''diceExpr''. | ||
Line 24: | Line 31: | ||
| ArgumentNullException || ''diceExpr'' is {{cs|null}}. | | ArgumentNullException || ''diceExpr'' is {{cs|null}}. | ||
|- | |- | ||
− | | [[ | + | | [[Dice/DiceException|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. | When a DiceException is thrown, the exception will contain an ErrorCode property which describes the error in more detail. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Latest revision as of 20:12, 23 December 2018
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,
RollerConfig config
)
Parameters
- diceExpr
- Type: System.String
- A dice expression.
- config
- Type: Dice.RollerConfig
- Configuration to use for this roll. If
null
, the DefaultConfig will be used.
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.