Check digital input signals that is sent as an integer using bitwise checking
Firstly, you can simplify the outer else statements:

...
    else
    {
      if ((currentBits &amp; INPUT_0) == INPUT_0)
      {
        ...
      }
    }
...


to

...
else if ((currentBits &amp; INPUT_0) == INPUT_0)
{
} ...




Secondly, if the check of all masks follows the same pattern as showed, you can create a mask checker method like this one (in C# 7.0):

private void HandleMask(int bitPattern, (int mask, Action&lt;bool&gt; action) maskItem)
{
  if ((bitPattern &amp; maskItem.mask) == maskItem.mask)
  {
    if ((currentBits &amp; maskItem.mask) != maskItem.mask)
    {
      currentBits |= maskItem.mask;
      maskItem.action(true);
    }
  }
  else if ((currentBits &amp; maskItem.mask) == maskItem.mask)
  {
    currentBits &amp;= ~maskItem.mask;
    maskItem.action(false);
  }
}

public void IoPort_sigInputChange(int p_nBits)
{
  lock (lockObj)
  {
    var maskItems = new(int mask, Action&lt;bool&gt; action)[]
    {
      (mask: INPUT_0, action: RaiseRunModeEvent),
      (mask: INPUT_1, action: RaiseAllPositionsSetEvent),
      (mask: INPUT_2, action: RaiseOrderEndedEvent),
    };

    foreach (var maskItem in maskItems)
    {
      HandleMask(p_nBits, maskItem);
    }
  }
}




Update 

In .net 3.5 you should/could do it in a way like this:

private void HandleMask(int bitPattern, int mask, Action&lt;bool&gt; action)
{
  if ((bitPattern &amp; mask) == mask)
  {
    if ((currentBits &amp; mask) != mask)
    {
      currentBits |= mask;
      action(true);
    }
  }
  else if ((currentBits &amp; mask) == mask)
  {
    currentBits &amp;= ~mask;
    action(false);
  }
}


public void IoPort_sigInputChange(int p_nBits)
{
  lock (lockObj)
  {
    var maskItems = new[]
    {
      new { mask = INPUT_0, action = (Action&lt;bool&gt;)RaiseRunModeEvent },
      new { mask = INPUT_1, action = (Action&lt;bool&gt;)RaiseAllPositionsSetEvent },
      new { mask = INPUT_2, action = (Action&lt;bool&gt;)RaiseOrderEndedEvent },
    };

    foreach (var maskItem in maskItems)
    {
      HandleMask(p_nBits, maskItem.mask, maskItem.action);
    }
  }
}