Improvements to a ViewModelBase Every time I go to write an MVVM application (say every 4-6 months) I rewrite my ViewModelBase class. This is for a range of reasons but let's say either I don't have access to prior code, the previous code was built for a client and isn't my code, or I'm working on someone else's machine and still don't have the code.

So I rewrite the basic INotifyPropertyChanged implementation, and I think it's a little different each time. Here's what I've come up with today: 

public class ViewModelBase : INotifyPropertyChanged
{
    protected void OnPropertyChanged&lt;T&gt;(Expression&lt;Func&lt;T&gt;&gt; expression)
    {
        var property = (MemberExpression)expression.Body;
        this.OnPropertyChanged(property.Member.Name);
    }

    protected void OnPropertyChanged(string name)
    {
        PropertyChangedEventHandler handler = PropertyChanged;
        if (handler != null)
        {
            handler(this, new PropertyChangedEventArgs(name));
        }
    }

    public event PropertyChangedEventHandler PropertyChanged;
}


I would like to get a nice implementation that is simple and small, and any improvements to this (what other functionality is required in a ViewModelBase?) would be great.
I've used the below for a while:

public abstract class PropertyChangedBase : INotifyPropertyChanged
{
    public event PropertyChangedEventHandler PropertyChanged;

    protected void RaisePropertyChanged(string propertyName)
    {
        var propertyChanged = this.PropertyChanged;

        if (propertyChanged != null)
        {
            propertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
    }

    protected bool SetProperty&lt;T&gt;(ref T backingField, T Value, Expression&lt;Func&lt;T&gt;&gt; propertyExpression)
    {
        var changed = !EqualityComparer&lt;T&gt;.Default.Equals(backingField, Value);

        if (changed)
        {
            backingField = Value;
            this.RaisePropertyChanged(ExtractPropertyName(propertyExpression));
        }

        return changed;
    }

    private static string ExtractPropertyName&lt;T&gt;(Expression&lt;Func&lt;T&gt;&gt; propertyExpression)
    {
        var memberExp = propertyExpression.Body as MemberExpression;

        if (memberExp == null)
        {
            throw new ArgumentException("Expression must be a MemberExpression.", "propertyExpression");
        }

        return memberExp.Member.Name;
    }
}


I can write my properties like this:

    private int id;

    public int Id
    {
        get
        {
            return this.id;
        }

        set
        {
            this.SetProperty(ref this.id, value, () =&gt; this.Id);
        }
    }