diff --git a/src/ReactiveUI/ReactiveCommand/ReactiveCommand.cs b/src/ReactiveUI/ReactiveCommand/ReactiveCommand.cs index 5347852fe7..1638111f08 100644 --- a/src/ReactiveUI/ReactiveCommand/ReactiveCommand.cs +++ b/src/ReactiveUI/ReactiveCommand/ReactiveCommand.cs @@ -25,6 +25,52 @@ namespace ReactiveUI /// /// This non-generic base class defines the creation behavior of the ReactiveCommand's. /// + /// + /// adds the concept of Input and Output generic types. + /// The Input is often passed in by the View and it's type is captured as TInput, and the Output is + /// the result of executing the command which type is captured as TOutput. + /// + /// + /// is IObservable which can be used like any other IObservable. + /// For example, you can Subscribe() to it like any other observable, and add the output to a List on your view model. + /// The Unit type is a functional programming construct analogous to void and can be used in cases where you don't + /// care about either the input and/or output value. + /// + /// + /// Creating synchronous reactive commands: + /// + /// (x => Console.WriteLine(x)); + /// + /// // This outputs 42 to console. + /// command.Execute(42).Subscribe(); + /// + /// // A better approach is to invoke a command in response to an Observable. + /// // InvokeCommand operator respects the command's executability. That is, if + /// // the command's CanExecute method returns false, InvokeCommand will not + /// // execute the command when the source observable ticks. + /// Observable.Return(42).InvokeCommand(command); + /// ]]> + /// + /// + /// + /// Creating asynchronous reactive commands: + /// + /// ( + /// () => Observable.Return(42).Delay(TimeSpan.FromSeconds(2)) + /// ); + /// + /// // Calling the asynchronous reactive command: + /// // Observable.Return(Unit.Default).InvokeCommand(command); + /// + /// // Subscribing to values emitted by the command: + /// command.Subscribe(Console.WriteLine); + /// ]]> + /// + /// /// [SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1402:FileMayOnlyContainASingleType", Justification = "Same class just generic.")] public static class ReactiveCommand