I try to do some minimal app for myself and I have a little problem with selected path. I have the following code:

```
  public partial class MainWindow : Window
{

    public MainWindow()
    {
        InitializeComponent();
    }               
    private void FilesCountNumberShow_button_Click(object sender, RoutedEventArgs e)
    {
        // Try to count nu,ber of files in folder
        int fCount = Directory.GetFiles(count_path, "*", SearchOption.TopDirectoryOnly).Length;
        FilesCountNumber_Label.Content = "Files in folder: " + fCount;

    }

    private void SelectFolderPath_button_Click(object sender, RoutedEventArgs e)
    {
        // These code is for open File Dialog and choose older path as count_path
        var SelectFolderPath_Dialog = new WinForms.FolderBrowserDialog();
        if (SelectFolderPath_Dialog.ShowDialog() == WinForms.DialogResult.OK)
        {
            string count_path = SelectFolderPath_Dialog.SelectedPath;
            MessageBox.Show(count_path);

        }

    }
}

```

}

How can I reference the variable `count_path` in 

```
 int fCount = Directory.GetFiles(count_path, "*", SearchOption.TopDirectoryOnly).Length;

```

I have information that it isn't exist (I think is locla variable in `SelectFolderPath_button_Click` right? How can I set it global? 

I do something that. I add `string count_path { get; set; }` there:

```
 public partial class MainWindow : Window
{
     string count_path { get; set; }

    public MainWindow()
    {
        InitializeComponent();
    }  

```

and modify 

```
 private void SelectFolderPath_button_Click(object sender, RoutedEventArgs e)
    {
        var SelectFolderPath_Dialog = new WinForms.FolderBrowserDialog();
        if (SelectFolderPath_Dialog.ShowDialog() == WinForms.DialogResult.OK)
        {
            count_path = SelectFolderPath_Dialog.SelectedPath;

            MessageBox.Show(count_path);

        }

    }

```

Is this good solution or should it be otherwise done?