public void AddElse(Int32 from, Int32 to) { if (ElseRange != null) { throw new InvalidOperationException($"Cannot replace existing else ({ElseRange}) by a new one."); } ElseRange = new ElseSegment(from, to); }
public void Render(RenderContext RenderContext) { RenderContext.CurrentText += StaticText; if (Method?.CheckMethodInfo() == true) { var BoolResult = Method.MethodInfo.Invoke(RenderContext.CurrentObject, new object[] { RenderContext.CurrentObject }); if (BoolResult != null && BoolResult.Equals(true)) { foreach (var Segment in Segments) { Segment.Render(RenderContext); } } else { ElseSegment?.Render(RenderContext); } } }