Implementation of BeginUpdate and EndUpdate
<p>1) I'm working on a project and I saw this piece of code, I don't understand what is the point of the Monitor.Lock statement. Can someone explain what its trying to do?</p>

<p>2) the postscript underscroll in the parameter name is really annoying, anyone else seen this naming convention?</p>

<pre><code>public class FieldsChangeableHelper&lt;T&gt; : IFieldsChangeable&lt;T&gt;
{
    object _lock;
    int _lockCount;
    FieldChanges&lt;T&gt; _changes;

    public FieldsChangeableHelper()
    {
        _lock = new object();
        _lockCount = 0;
    }

    public void AddChange(T field_, object oldValue_)
    {
        if (_changes == null)
            _changes = new FieldChanges&lt;T&gt;(field_, oldValue_);
        else
            _changes.AddChange(field_, oldValue_);
        if (RaiseEvent(_changes))
            _changes = null;
    }

    #region IFieldsChangeable Members

    public void BeginUpdate()
    {
        if (System.Threading.Interlocked.Increment(ref _lockCount) == 1)
            Monitor.Enter(_lock);
    }

    public void EndUpdate()
    {
        if (System.Threading.Interlocked.Decrement(ref _lockCount) == 0)
        {
            FieldChanges&lt;T&gt; changes = _changes;
            _changes = null;
            Monitor.Exit(_lock);
            RaiseEvent(changes);
        }
    }


    protected bool RaiseEvent(FieldChanges&lt;T&gt; changes_)
    {
        if (_lockCount == 0 &amp;&amp; Changed != null &amp;&amp; changes_ != null)
        {
            Changed(this, changes_);
            return true;
        }
        return false;
    }

    public event FieldsChanged&lt;T&gt; Changed;

    #endregion
}
</code></pre>
