StyleCop.CSharp by StyleCop contributors, Andy Reeves, Chris Dahlberg

<PackageReference Include="StyleCop.CSharp" Version="6.2.0" />

.NET API 245,760 bytes

 CsDocument

Represents a parsed C# document.
using System.Collections.Generic; namespace StyleCop.CSharp { public sealed class CsDocument : ICodePart, ITokenContainer { private DocumentRoot contents; private FileHeader fileHeader; private CsParser parser; private MasterList<CsToken> tokens; public CodePartType CodePartType => CodePartType.Document; public override ICodeElement DocumentContents => contents; public FileHeader FileHeader { get { return fileHeader; } internal set { fileHeader = value; } } public int LineNumber => 1; public CodeLocation Location => CsToken.JoinLocations(tokens.get_First(), tokens.get_Last()); public ICodePart Parent => null; public CsParser Parser => parser; public DocumentRoot RootElement { get { return contents; } internal set { contents = value; } } public MasterList<CsToken> Tokens => tokens.get_AsReadOnly(); ICollection<CsToken> ITokenContainer.Tokens { get { return (ICollection<CsToken>)tokens.get_AsReadOnly(); } } internal MasterList<CsToken> MasterTokenList => tokens; internal CsDocument(SourceCode sourceCode, CsParser parser, MasterList<CsToken> tokens) : this(sourceCode) { this.parser = parser; this.tokens = tokens; } internal CsDocument(SourceCode sourceCode, CsParser parser) : this(sourceCode, parser, null) { tokens = new MasterList<CsToken>(); } public void WalkDocument<T>(CodeWalkerElementVisitor<T> elementCallback, CodeWalkerStatementVisitor<T> statementCallback, CodeWalkerExpressionVisitor<T> expressionCallback, CodeWalkerQueryClauseVisitor<T> queryClauseCallback, T context) { CodeWalker<T>.Start(this, elementCallback, statementCallback, expressionCallback, queryClauseCallback, context); } public void WalkDocument<T>(CodeWalkerElementVisitor<T> elementCallback, CodeWalkerStatementVisitor<T> statementCallback, CodeWalkerExpressionVisitor<T> expressionCallback, T context) { WalkDocument(elementCallback, statementCallback, expressionCallback, null, context); } public void WalkDocument<T>(CodeWalkerElementVisitor<T> elementCallback, CodeWalkerStatementVisitor<T> statementCallback, T context) { WalkDocument(elementCallback, statementCallback, null, null, context); } public void WalkDocument<T>(CodeWalkerElementVisitor<T> elementCallback, T context) { WalkDocument(elementCallback, null, null, null, context); } public void WalkDocument(CodeWalkerElementVisitor<object> elementCallback, CodeWalkerStatementVisitor<object> statementCallback, CodeWalkerExpressionVisitor<object> expressionCallback, CodeWalkerQueryClauseVisitor<object> queryClauseCallback) { CodeWalker<object>.Start(this, elementCallback, statementCallback, expressionCallback, queryClauseCallback, null); } public void WalkDocument(CodeWalkerElementVisitor<object> elementCallback, CodeWalkerStatementVisitor<object> statementCallback, CodeWalkerExpressionVisitor<object> expressionCallback) { WalkDocument(elementCallback, statementCallback, expressionCallback, null, null); } public void WalkDocument(CodeWalkerElementVisitor<object> elementCallback, CodeWalkerStatementVisitor<object> statementCallback) { WalkDocument(elementCallback, statementCallback, null, null, null); } public void WalkDocument(CodeWalkerElementVisitor<object> elementCallback) { WalkDocument(elementCallback, null, null, null, null); } protected override void Dispose(bool disposing) { this.Dispose(disposing); if (disposing) { contents = null; tokens = null; fileHeader = null; parser = null; } } } }