How to delete a file, after checking if it exists or not using C#?

I would like to know, how can I delete a file, after checking if it exists on the hard disk, if yes, then delete it, using C# in


Asked by:- neena
: 174 At:- 1/17/2019 12:31:34 PM
C# ASP.NET Delete a file using C#

1 Answers
profileImage Answered by:- Vinnu

Using System.IO.File class you can check if file exists or not, then delete it in C#, as below


You can also read the detailed about File Input / Output in C# .

At:- 1/18/2019 3:36:46 PM
Thank you, works as needed. 0
By : neena - at :- 1/31/2019 9:37:25 AM

Login/Register to answer
Register directly by posting answer/details

Full Name *

Email *

By posting your answer you agree on privacy policy & terms of use