System.Text.RegularExpressions.RegexNode.StripEnation C# (CSharp) Method

StripEnation() private method

Simple optimization. If a concatenation or alternation has only one child strip out the intermediate node. If it has zero children, turn it into an empty.
private StripEnation ( int emptyType ) : RegexNode
emptyType int
return RegexNode
        internal RegexNode StripEnation(int emptyType)
        {
            switch (ChildCount())
            {
                case 0:
                    return new RegexNode(emptyType, _options);
                case 1:
                    return Child(0);
                default:
                    return this;
            }
        }