I have subscribed to CollectionChanged
event of ObservableCollection<string> m_myCollection
like this:
private ObservableCollection<string> m_myCollection;
public ObservableCollection<string> MyCollection
{
get => m_myCollection;
set
{
m_myCollection= value;
OnPropertyChanged();
}
}
public ViewModel()
{
MyCollection = new ObservableCollection<string>();
MyCollection.CollectionChanged += OnCollectionChanged;
MyCollection.Add("Item 1");
}
private void OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
// How to get the name of the collection here? That is: "MyCollection"
}
How do I get the name of the collection in the method?