Pihrtsoft.Text.RegularExpressions.Linq.PatternBuilder.AppendIfAssert C# (CSharp) Метод

AppendIfAssert() публичный Метод

Appends an if construct.
public AppendIfAssert ( object testContent, object trueContent, object falseContent ) : void
testContent object The pattern to assert.
trueContent object The pattern to match if the assertion succeeds.
falseContent object The pattern to match if the assertion fails.
Результат void
        public void AppendIfAssert(object testContent, object trueContent, object falseContent)
        {
            if (testContent == null)
                throw new ArgumentNullException(nameof(testContent));

            if (trueContent == null)
                throw new ArgumentNullException(nameof(trueContent));

            AppendGroupStart();
            AppendDirect('(');

            if (_fBuilder)
                _builder.AddInfo(SyntaxKind.IfAssert);

            if (!Settings.HasOptions(PatternOptions.IfConditionWithoutAssertion))
                AppendDirect("?=");

            AppendGroupContent(testContent);
            AppendGroupEnd();

            RegexOptions currentOptions = CurrentOptions;

            _indentLevel++;

            if (falseContent == null)
            {
                Append(trueContent, GroupMode.None);
            }
            else
            {
                Append(trueContent);
                AppendOr(falseContent);
            }

            AppendGroupEnd();

            CurrentOptions = currentOptions;
        }

Usage Example

Пример #1
0
 internal override void AppendTo(PatternBuilder builder)
 {
     builder.AppendIfAssert(_testContent, _trueContent, _falseContent);
 }