iSynaptic.Commons.Text.IndentingTextWriter.IncreaseIndentation C# (CSharp) Method

IncreaseIndentation() public method

public IncreaseIndentation ( Int32 increaseBy ) : void
increaseBy System.Int32
return void
        public void IncreaseIndentation(Int32 increaseBy)
        {
            if (increaseBy <= 0) throw new ArgumentOutOfRangeException("increaseBy", "Provided value must be greater than 0.");

            Int32 newIndentation = Indentation + increaseBy;
            if (newIndentation < 0)
                newIndentation = Int32.MaxValue;

            Indentation = newIndentation;
        }

Same methods

IndentingTextWriter::IncreaseIndentation ( ) : void

Usage Example

Esempio n. 1
0
        public void IncreasingIndentation_ByMustBeGreaterThanZero()
        {
            var sw = new StringWriter();
            var iw = new IndentingTextWriter(sw, "  ");

            Assert.Throws <ArgumentOutOfRangeException>(() => iw.IncreaseIndentation(0));
            Assert.Throws <ArgumentOutOfRangeException>(() => iw.IncreaseIndentation(-42));
        }
All Usage Examples Of iSynaptic.Commons.Text.IndentingTextWriter::IncreaseIndentation