public static CannotCastArgumentToActionArgument ( object argument, string action ) : string | ||
argument | object | The argument. |
action | string | The action. |
Результат | string |
/// <summary> /// Executes the transition action. /// </summary> /// <param name="argument">The state machine event argument.</param> public void Execute(object argument) { if (argument != null && !(argument is T)) { throw new ArgumentException(ActionHoldersExceptionMessages.CannotCastArgumentToActionArgument(argument, this.Describe())); } this.action((T)argument); }
public void Execute(object argument) { T castArgument = default(T); if (argument != Missing.Value && argument != null && !(argument is T)) { throw new ArgumentException(ActionHoldersExceptionMessages.CannotCastArgumentToActionArgument(argument, this.Describe())); } if (argument != Missing.Value) { castArgument = (T)argument; } this.action(castArgument); }
protected override Action GetActionCall(object argument, CancellationToken cancellation) { T castArgument = default(T); if (argument != Missing.Value && !(argument is T)) { throw new ArgumentException(ActionHoldersExceptionMessages.CannotCastArgumentToActionArgument(argument, this.Describe())); } if (argument != Missing.Value) { castArgument = (T)argument; } return(() => this.action(castArgument, cancellation)); }