public static Boolean IfThen(ref UInt32 value, UInt32 @if, UInt32 then) { return(InterlockedEx.CompareExchange(ref value, then, @if) == @if); }
public static Boolean IfThen(ref UInt32 value, UInt32 @if, UInt32 then, out UInt32 previousValue) { previousValue = InterlockedEx.CompareExchange(ref value, then, @if); return(previousValue == @if); }