Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn if invoking with eventargs #133

Open
JohanLarsson opened this issue Aug 22, 2019 · 0 comments
Open

Warn if invoking with eventargs #133

JohanLarsson opened this issue Aug 22, 2019 · 0 comments

Comments

@JohanLarsson
Copy link
Collaborator

public class ViewModel : INotifyPropertyChanged
{
	private int bar;

	public event PropertyChangedEventHandler PropertyChanged;

	public int Bar
	{
		get { return this.bar; }
		set
		{
			if (value == this.bar)
			{
				this.bar = value;this.OnPropertyChanged(new PropertyChangedEventArgs(nameof(Bar)));
			}
		}
	}

	protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
	{
		this.PropertyChanged?.Invoke(this, e);
	}
}

Clumsy and inefficient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant