If you want to replace a file extension in C# , you can use the ChangeExtension method defined in the System.IO.Path class.
Below is a sample code snippet demonstrating how to do it.
How to replace a File extension in C# ?
string fileName = @"C:\test.new"; var result; result = Path.ChangeExtension(fileName, ".old");
Leave a Reply