Modifying a key to a dictionary and writing it back to file

George Tyrebyter 46 Reputation points
2022-12-20T21:34:09.553+00:00

I have a text file that's read into a dictionary using a .net 6.0 console app. What's the best solution for modifying one or more of the keys, write the dictionary back to the original file.

Example:

Current Text read into a dictionary
C:\Temp\Temp123 123
C:\Temp\Temp456 456

Updated Text
C:\Temp\Temp123 123
$C:\Temp\Temp456 456 <-note the character used as a comment

The above updated text is written back to a text file - original is preferred.

Thanks,
Al

.NET CLI
.NET CLI
A cross-platform toolchain for developing, building, running, and publishing .NET applications.
326 questions
0 comments No comments
{count} votes