I'm trying to delete image after deleting record from list in wpf C#. but it always throw exception that file is used by anohter process and not allow me to delete.
string appPath = Path.GetDirectoryName(System.AppDomain.CurrentDomain.BaseDirectory) + @"\screenshots\";
string schemename = selectedStockObject.Name.ToString();
objSchemeBLL = new SchemeBLL();
Scheme objTemp = objSchemeBLL.getSchemebyName(schemename);
GC.Collect();
Thread.Sleep(20);
File.Delete(objTemp.ImgPath);
1 Reply
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Suthish NairPosted Jul 14, 2016, 2:44 AM