DiagnosticsBag Class

A container for DiagnosticMessage

public class DiagnosticsBag : IEnumerable<DiagnosticMessage>, IEnumerable
Implements

Constructors

NameDescription
DiagnosticsBag()Creates a new instance of a DiagnosticsBag
DiagnosticsBag(IEnumerable<DiagnosticMessage>)Creates a new instance of a DiagnosticsBag.

DiagnosticsBag overloads

DiagnosticsBag()

DiagnosticsBag.cs

Creates a new instance of a DiagnosticsBag

public DiagnosticsBag()

DiagnosticsBag(IEnumerable<DiagnosticMessage>)

DiagnosticsBag.cs

Creates a new instance of a DiagnosticsBag.

public DiagnosticsBag(IEnumerable<DiagnosticMessage> messages)
Parameters
messages IEnumerable<DiagnosticMessage>
An existing list of messages.

Properties

NameDescription
CountGets the number of messages.
HasErrorsGets a boolean indicating if this bag contains any error messages.

Gets the number of messages.

public int Count { get; }

Property value

int

Gets a boolean indicating if this bag contains any error messages.

public bool HasErrors { get; }

Property value

bool

Indexers

NameDescription
this[int]Gets the message at the specified index.

Gets the message at the specified index.

public DiagnosticMessage this[int index] { get; }

Parameters

index int
Index of the message.

Property value

DiagnosticMessage

Methods

NameDescription
Add(DiagnosticMessage)Adds the specified message to this bag.
AddRange(IEnumerable<DiagnosticMessage>)Adds the specified list of messages to this bag.
Clear()Clear this bag including the error state.
Error(SourceSpan, string)Adds an error message
GetEnumerator()Gets the enumerator of DiagnosticMessage
System.Collections.Generic.IEnumerable<Meziantou.Framework.Toml.Syntax.DiagnosticMessage>.GetEnumerator()
System.Collections.IEnumerable.GetEnumerator()
ToString()Returns a string that represents the current object.
Warning(SourceSpan, string)Adds a warning message

Add(DiagnosticMessage)

DiagnosticsBag.cs

Adds the specified message to this bag.

public void Add(DiagnosticMessage message)

Parameters

message DiagnosticMessage
The message to add

AddRange(IEnumerable<DiagnosticMessage>)

DiagnosticsBag.cs

Adds the specified list of messages to this bag.

public void AddRange(IEnumerable<DiagnosticMessage> messages)

Parameters

messages IEnumerable<DiagnosticMessage>
A list of messages.

Clear this bag including the error state.

public void Clear()

Error(SourceSpan, string)

DiagnosticsBag.cs

Adds an error message

public void Error(SourceSpan span, string text)

Parameters

span SourceSpan
The source span
text string
The error message

GetEnumerator()

DiagnosticsBag.cs

Gets the enumerator of DiagnosticMessage

public List<DiagnosticMessage>.Enumerator GetEnumerator()

System.Collections.Generic.IEnumerable<Meziantou.Framework.Toml.Syntax.DiagnosticMessage>.GetEnumerator()

DiagnosticsBag.cs

No documentation is available.

System.Collections.IEnumerable.GetEnumerator()

DiagnosticsBag.cs
IEnumerator IEnumerable.GetEnumerator()

No documentation is available.

Returns a string that represents the current object.

public override string ToString()

Returns

string A string that represents the current object.

Warning(SourceSpan, string)

DiagnosticsBag.cs

Adds a warning message

public void Warning(SourceSpan span, string text)

Parameters

span SourceSpan
The source span
text string
The warning message