You should use
Path.ChangeExtension
method.
MSDN Link[
^]
var result = Path.ChangeExtension(yourfile, ".jpg");
If you want to physically change the extension, you could use
File.Move
method:
File.Move(yourfile, Path.ChangeExtension(yourfile, ".jpg"));
Good luck,
OI