System.Text.DecoderReplacementFallbackBuffer.MovePrevious C# (CSharp) Method

MovePrevious() public method

public MovePrevious ( ) : bool
return bool
        public override bool MovePrevious()
        {
            // Back up one, only if we just processed the last character (or earlier)
            if (fallbackCount >= -1 && fallbackIndex >= 0)
            {
                fallbackIndex--;
                fallbackCount++;
                return true;
            }

            // Return false 'cause we couldn't do it.
            return false;
        }

Usage Example

		public void FallbackEmptyForEncodingUTF8 ()
		{
			Buffer b = new DecoderReplacementFallbackBuffer (new DecoderReplacementFallback (String.Empty));
			Assert.IsFalse (b.Fallback (new byte [] {}, 0), "#1");
			Assert.IsFalse (b.MovePrevious (), "#2");
			Assert.AreEqual (0, b.Remaining, "#3");
			// the string does not exist.
			Assert.AreEqual (char.MinValue, b.GetNextChar (), "#4");
		}
All Usage Examples Of System.Text.DecoderReplacementFallbackBuffer::MovePrevious