System.ComponentModel.MaskedTextProvider.Add C# (CSharp) Method

Add() public method

Attempts to add the characters in the specified string to the last unoccupied positions in the test string (append text to the virtual string). On exit the testPosition contains last position where the primary operation was actually performed if successful, otherwise the first position that made the test fail. This position is relative to the test string. The MaskedTextResultHint out param gives a hint about the operation result reason. Returns true on success, false otherwise.
public Add ( string input, int &testPosition, MaskedTextResultHint &resultHint ) : bool
input string
testPosition int
resultHint MaskedTextResultHint
return bool
        public bool Add(string input, out int testPosition, out MaskedTextResultHint resultHint)
        {
            if (input == null)
            {
                throw new ArgumentNullException(nameof(input));
            }

            testPosition = LastAssignedPosition + 1;

            if (input.Length == 0) // nothing to add.
            {
                // Get position where the test would be performed.
                resultHint = MaskedTextResultHint.NoEffect;
                return true;
            }

            return TestSetString(input, testPosition, out testPosition, out resultHint);
        }

Same methods

MaskedTextProvider::Add ( char input ) : bool
MaskedTextProvider::Add ( char input, int &testPosition, MaskedTextResultHint &resultHint ) : bool
MaskedTextProvider::Add ( string input ) : bool

Usage Example

		public void Add_string_int_MaskedTextResultHint_Test00001 ()
		{
			MaskedTextProvider mtp;
			int testPosition;
			MaskedTextResultHint resultHint;
			bool result;
			int Int32_out = 0;
			MaskedTextResultHint MaskedTextResultHint_out = MaskedTextResultHint.Unknown;
			mtp = new MaskedTextProvider (@"abc");
			mtp.Add (@"a");
			mtp.Add ('\x61');
			mtp.Add ('\x61', out Int32_out, out MaskedTextResultHint_out);
			result = mtp.Add (@"", out testPosition, out resultHint);
			Assert.AreEqual (true, result, "GenerateAdd_string_int_MaskedTextResultHint_Test#0");
			Assert.AreEqual (MaskedTextResultHint.NoEffect, resultHint, "GenerateAdd_string_int_MaskedTextResultHint_Test#1");
			Assert.AreEqual (1, testPosition, "GenerateAdd_string_int_MaskedTextResultHint_Test#2");
			MaskedTextProviderTest.AssertProperties (mtp, "GenerateAdd_string_int_MaskedTextResultHint_Test", 3, true, false, 1, 0, CultureInfo.GetCultureInfo ("es-ES"), 1, true, false, false, 0, 3, @"abc", true, true, '\x0', '\x5F', true, true, true, @"abc", @"abc", @"abc", @"abc", @"a", @"abc", @"a");

		}
All Usage Examples Of System.ComponentModel.MaskedTextProvider::Add