private void ButtonSave_Click(object sender, RoutedEventArgs e) { if (_results == null || !_results.Any()) { return; } var dialog = new SaveFileDialog { OverwritePrompt = true, DefaultExt = ".csv", AddExtension = true, FileName = $"{textBoxLocation.Text}-{textBoxTypes.Text}-{textBoxRadius.Text}" }; if (dialog.ShowDialog() ?? false) { File.WriteAllText(dialog.FileName, CsvSerializer.EncodeResults(_results), Encoding.UTF8); } }