Interface IConditional<TSelf>
- Namespace
- DynaSharp
- Assembly
- DynaSharp.dll
A command that takes a condition. It is the way to write a helper that works on all of them, without knowing the command:
public static TCommand OnlyIfOwned<TCommand>(this TCommand command, string owner)
where TCommand : IConditional<TCommand>, allows ref struct =>
command.If(Attr("owner").Eq(owner));
public interface IConditional<TSelf> where TSelf : IConditional<TSelf>, allows ref struct
Type Parameters
TSelfThe command.
Methods
If<TCondition>(TCondition)
Adds a condition. The write happens only if it holds, and a second condition means both must hold.
TSelf If<TCondition>(TCondition condition) where TCondition : ICondition
Parameters
conditionTConditionThe condition.
Returns
- TSelf
The command, which replaces this one.
Type Parameters
TConditionThe type of the condition.