There is: Path.ChangeExtension
method. E.g.:
var result = Path.ChangeExtension(myffile, ".jpg");
In the case if you also want to physically change the extension, you could use File.Move
method:
File.Move(myffile, Path.ChangeExtension(myffile, ".jpg"));
More Related Contents:
- Combine two (or more) PDF’s
- Why doesn’t IList support AddRange
- Get free disk space
- ASP.NET Core 3.0 [FromBody] string content returns “The JSON value could not be converted to System.String.”
- Convert DataTable to List
- How can I use enum types in XAML?
- Difference between Dependency Injection and Mocking Framework (Ninject vs RhinoMocks or Moq)
- How to find out next character alphabetically?
- Class with same name in two assemblies (intentionally)
- C#: How to start a thread at a specific time [duplicate]
- Validate Google Id Token
- The relationship could not be changed because one or more of the foreign-key properties is non nullable
- How Thread-Safe is NLog?
- How do you use XMLSerialize for Enum typed properties in c#?
- F5 or Start Debugging Button is Greyed Out for Winform application?
- “Could not load file or assembly System.Drawing or one of its dependencies” error on .Net 2.0, VS2010 and Windows 8
- Merging overlapping time intervals?
- MVC6 Dropdownlist of Countries
- OpenQA.Selenium.WebDriverException: ‘Cannot start the driver service on http://localhost:20548/’
- What does the ‘%’ operator mean?
- Databind a dropdownlist
- Why doesn’t the conditional operator correctly allow the use of “null” for assignment to nullable types? [duplicate]
- Replace all occurrences of the Tab character within double quotes
- how to convert my decimal thread ID to hex and make it appear in hex format in log4net conversion pattern?
- SpeechRecognitionEngine.InstalledRecognizers returns No recognizer installed
- C# Dynamic Event Subscription
- Enum localization
- Left bit shifting 255 (as a byte)
- IDictionary contravariance?
- What is the fastest way to count set bits in UInt32