Using method groups instead of lamdas
Syntax is more succint and less compile-time overheard by not using lambdas
MODIFY
WalletWasabi.Gui/Controls/ExtendedTextBox.cs
WalletWasabi.Gui/Controls/ExtendedTextBox.cs
@@ -32,8 +32,8 @@ namespace WalletWasabi.Gui.Controls
await PasteAsync();
});
- CopyCommand.ThrownExceptions.Subscribe(ex => Logging.Logger.LogWarning<ExtendedTextBox>(ex));
- PasteCommand.ThrownExceptions.Subscribe(ex => Logging.Logger.LogWarning<ExtendedTextBox>(ex));
+ CopyCommand.ThrownExceptions.Subscribe(Logging.Logger.LogWarning<ExtendedTextBox>);
+ PasteCommand.ThrownExceptions.Subscribe(Logging.Logger.LogWarning<ExtendedTextBox>);
this.GetObservable(IsReadOnlyProperty).Subscribe(isReadOnly =>
{

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/CoinListViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/CoinListViewModel.cs
@@ -228,7 +228,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
.ObserveOn(RxApp.MainThreadScheduler)
.Subscribe();
- SortCommand = ReactiveCommand.Create(() => RefreshOrdering());
+ SortCommand = ReactiveCommand.Create(RefreshOrdering);
this.WhenAnyValue(x => x.AmountSortDirection)
.ObserveOn(RxApp.MainThreadScheduler)
@@ -371,7 +371,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
}
}, outputScheduler: RxApp.MainThreadScheduler);
- InitList.ThrownExceptions.Subscribe(ex => Logging.Logger.LogError<CoinListViewModel>(ex));
+ InitList.ThrownExceptions.Subscribe(Logging.Logger.LogError<CoinListViewModel>);
}
private void OnOpen()

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/HistoryTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/HistoryTabViewModel.cs
@@ -49,7 +49,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
await transaction.TryCopyTxIdToClipboardAsync();
});
- SortCommand = ReactiveCommand.Create(() => RefreshOrdering());
+ SortCommand = ReactiveCommand.Create(RefreshOrdering);
DateSortDirection = SortOrder.Decreasing;
@@ -96,10 +96,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
{
try
{
- var txRecordList = await Task.Run(() =>
- {
- return BuildTxRecordList();
- });
+ var txRecordList = await Task.Run(BuildTxRecordList);
var rememberSelectedTransactionId = SelectedTransaction?.TransactionId;
Transactions?.Clear();

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/ReceiveTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/ReceiveTabViewModel.cs
@@ -79,7 +79,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
});
});
- this.WhenAnyValue(x => x.Label).Subscribe(x => UpdateSuggestions(x));
+ this.WhenAnyValue(x => x.Label).Subscribe(UpdateSuggestions);
this.WhenAnyValue(x => x.SelectedAddress).Subscribe(async address =>
{

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/SendTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/SendTabViewModel.cs
@@ -193,7 +193,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
this.WhenAnyValue(x => x.Label)
.ObserveOn(RxApp.MainThreadScheduler)
- .Subscribe(x => UpdateSuggestions(x));
+ .Subscribe(UpdateSuggestions);
this.WhenAnyValue(x => x.FeeTarget)
.ObserveOn(RxApp.MainThreadScheduler)

MODIFY
WalletWasabi.Gui/Dialogs/CannotCloseDialogViewModel.cs
WalletWasabi.Gui/Dialogs/CannotCloseDialogViewModel.cs
@@ -78,8 +78,8 @@ namespace WalletWasabi.Gui.Dialogs
},
canCancel);
- OKCommand.ThrownExceptions.Subscribe(ex => Logging.Logger.LogWarning<CannotCloseDialogViewModel>(ex));
- CancelCommand.ThrownExceptions.Subscribe(ex => Logging.Logger.LogWarning<CannotCloseDialogViewModel>(ex));
+ OKCommand.ThrownExceptions.Subscribe(Logging.Logger.LogWarning<CannotCloseDialogViewModel>);
+ CancelCommand.ThrownExceptions.Subscribe(Logging.Logger.LogWarning<CannotCloseDialogViewModel>);
}
public override void OnOpen()

MODIFY
WalletWasabi.Gui/Program.cs
WalletWasabi.Gui/Program.cs
@@ -54,10 +54,7 @@ namespace WalletWasabi.Gui
{
MainWindowViewModel.Instance.Title += $" - {Global.Network}";
}
- Dispatcher.UIThread.Post(() =>
- {
- GC.Collect();
- });
+ Dispatcher.UIThread.Post(GC.Collect);
}).StartShellApp<AppBuilder, MainWindow>("Wasabi Wallet", null, () => MainWindowViewModel.Instance);
}
catch (Exception ex)

MODIFY
WalletWasabi.Gui/Tabs/WalletManager/GenerateWalletSuccessViewModel.cs
WalletWasabi.Gui/Tabs/WalletManager/GenerateWalletSuccessViewModel.cs
@@ -13,10 +13,7 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
{
_mnemonicWords = mnemonic.ToString();
- ConfirmCommand = ReactiveCommand.Create(() =>
- {
- owner.SelectTestPassword();
- });
+ ConfirmCommand = ReactiveCommand.Create(owner.SelectTestPassword);
}
public string MnemonicWords

MODIFY
WalletWasabi.Gui/Tabs/WalletManager/GenerateWalletViewModel.cs
WalletWasabi.Gui/Tabs/WalletManager/GenerateWalletViewModel.cs
@@ -26,10 +26,7 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
{
Owner = owner;
- GenerateCommand = ReactiveCommand.Create(() =>
- {
- DoGenerateCommand();
- },
+ GenerateCommand = ReactiveCommand.Create(DoGenerateCommand,
this.WhenAnyValue(x => x.TermsAccepted));
this.WhenAnyValue(x => x.Password).Subscribe(x =>

MODIFY
WalletWasabi.Gui/Tabs/WalletManager/LoadWalletViewModel.cs
WalletWasabi.Gui/Tabs/WalletManager/LoadWalletViewModel.cs
@@ -150,9 +150,9 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
}
}, outputScheduler: RxApp.MainThreadScheduler);
- LoadCommand.ThrownExceptions.Subscribe(ex => Logger.LogWarning<LoadWalletViewModel>(ex));
- TestPasswordCommand.ThrownExceptions.Subscribe(ex => Logger.LogWarning<LoadWalletViewModel>(ex));
- OpenFolderCommand.ThrownExceptions.Subscribe(ex => Logger.LogWarning<LoadWalletViewModel>(ex));
+ LoadCommand.ThrownExceptions.Subscribe(Logger.LogWarning<LoadWalletViewModel>);
+ TestPasswordCommand.ThrownExceptions.Subscribe(Logger.LogWarning<LoadWalletViewModel>);
+ OpenFolderCommand.ThrownExceptions.Subscribe(Logger.LogWarning<LoadWalletViewModel>);
ImportColdcardCommand.ThrownExceptions.Subscribe(ex => Logger.LogWarning<LoadWalletViewModel>(ex));
SetLoadButtonText();

MODIFY
WalletWasabi.Gui/Tabs/WalletManager/RecoverWalletViewModel.cs
WalletWasabi.Gui/Tabs/WalletManager/RecoverWalletViewModel.cs
@@ -86,7 +86,7 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
}
});
- this.WhenAnyValue(x => x.MnemonicWords).Subscribe(x => UpdateSuggestions(x));
+ this.WhenAnyValue(x => x.MnemonicWords).Subscribe(UpdateSuggestions);
this.WhenAnyValue(x => x.Password).Subscribe(x =>
{
try

MODIFY
WalletWasabi/Models/BannedUtxoRecord.cs
WalletWasabi/Models/BannedUtxoRecord.cs
@@ -35,7 +35,7 @@ namespace WalletWasabi.Models
var bannedForRound = long.Parse(parts[5]);
var utxo = new OutPoint(new uint256(parts[3]), int.Parse(parts[2]));
var severity = int.Parse(parts[1]);
- var timeParts = parts[0].Split('-', ' ').Select(x => int.Parse(x)).ToArray();
+ var timeParts = parts[0].Split('-', ' ').Select(int.Parse).ToArray();
var timeOfBan = new DateTimeOffset(timeParts[0], timeParts[1], timeParts[2], timeParts[3], timeParts[4], timeParts[5], TimeSpan.Zero);
return new BannedUtxoRecord(utxo, severity, timeOfBan, isNoted, bannedForRound);

MODIFY
WalletWasabi/Services/WalletService.cs
WalletWasabi/Services/WalletService.cs
@@ -995,7 +995,7 @@ namespace WalletWasabi.Services
using (await BlockFolderLock.LockAsync())
{
var filePaths = Directory.EnumerateFiles(BlocksFolderPath);
- var fileNames = filePaths.Select(x => Path.GetFileName(x));
+ var fileNames = filePaths.Select(Path.GetFileName);
var hashes = fileNames.Select(x => new uint256(x));
if (hashes.Contains(hash))

Using method groups instead of lamdas

Syntax is more succint and less compile-time overheard by not using lambdas