MVVM Light : RelayCommand : define it lazy or in constructor?
问题 There are several examples on how to define a RelayCommand in the ViewModel : Option 1 ( lazy ): /// <summary> /// Gets the LogOnCommand. /// </summary> /// <value>The LogOnCommand.</value> public RelayCommand<LogOnUser> LogOnCommand { get { if (this.logOnCommand == null) { this.logOnCommand = new RelayCommand<LogOnUser>( action => { // Action code... }, g => g != null); } return this.logOnCommand; } } Option 2 (in constructor) /// <summary> /// Initializes a new instance of the <see cref=