Code2Xml.Core.Location.StructuredCode.GetLine C# (CSharp) Method

GetLine() public method

public GetLine ( int line ) : string
line int
return string
        public string GetLine(int line) {
            var startIndex = Indices[line];
            if (Indices.Count > line + 1) {
                // Exclude a new line
                return Code.Substring(startIndex, Indices[line + 1] - 1 - startIndex);
            }
            return Code.Substring(startIndex);
        }

Usage Example

Example #1
0
 public void GetLine(string code, int lineNumber) {
     var structuredCode = new StructuredCode(code);
     structuredCode.GetLine(lineNumber);
 }