Shazwazza opened a new pull request, #1235:
URL: https://github.com/apache/lucenenet/pull/1235
Fixes #1226
`SessionToken.ToString()` was using 23 lines of manual StringBuilder logic
to format the SourceFiles dictionary. This PR replaces it with the standard
`Collections.ToString()` helper used throughout the codebase.
**Changes:**
- Simplified `SessionToken.ToString()` from 26 lines to 3 lines using
`Collections.ToString(SourceFiles)`
- Added `using Lucene.Net.Support` import for Collections helper
- Output format unchanged: `id={id} version={ver} files={source1=[file1,
file2], source2=[file3]}`
**Before:**
```csharp
public override string ToString()
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("id=").Append(Id).Append(" version=").Append(Version).Append("
files={");
bool firstSource = true;
foreach (KeyValuePair<string, IList<RevisionFile>> pair in SourceFiles)
{
if (!firstSource)
sb.Append(", ");
firstSource = false;
sb.Append(pair.Key).Append("=[");
bool firstFile = true;
foreach (RevisionFile file in pair.Value)
{
if (!firstFile)
sb.Append(", ");
firstFile = false;
sb.Append(file.ToString());
}
sb.Append("]");
}
sb.Append("}");
return sb.ToString();
}
```
**After:**
```csharp
public override string ToString()
{
return string.Format("id={0} version={1} files={2}", Id, Version,
Collections.ToString(SourceFiles));
}
```
This aligns with the standard pattern used in 20+ other files in the
codebase and handles nested collections recursively.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]