mardi 11 août 2020

"Use pattern matching" Message

Visual Studio gives me the Message:

Use pattern matching

With the Code IDE0020

The Snippet:

private void BTclear_Clicked(object sender, RoutedEventArgs e)
{
  Button BTclear = (Button)sender;
  if (BTclear.DataContext is ObservableCollectionUser)
  {
    ObservableCollectionUser clearMe = (ObservableCollectionUser)BTclear.DataContext;
    Users.Remove(clearMe);
  }
}

The if statement is green underlined.

What does it mean and how can I optimize it?

Aucun commentaire:

Enregistrer un commentaire