This program will help you to change a file extension using C# code. C# provide a inbuilt method ChangeExtension to change the file extension.
As you can see in the output, the file have different extension.
using System;
using System.IO;
namespace MyApp
{
class Extension_class
{
static void Main()
{
string myPath = Path.ChangeExtension(@"D:\my_file.txt", "bat");
Console.WriteLine(myPath);
Console.Read();
}
}
}
No comments:
Post a Comment