OpenStory.Common.AtomicInteger.ExchangeWith C# (CSharp) Method

ExchangeWith() public method

Exchanges the value of this AtomicInteger by with newValue and returns the original value.
public ExchangeWith ( int newValue ) : int
newValue int The new value.
return int
        public int ExchangeWith(int newValue)
        {
            return Interlocked.Exchange(ref this.value, newValue);
        }

Usage Example

        public void ExchangeWith_Should_Return_Old_Value()
        {
            var i = new AtomicInteger(123);

            var old = i.ExchangeWith(321);

            old.Should().Be(123);
        }
All Usage Examples Of OpenStory.Common.AtomicInteger::ExchangeWith