سلام من دارم در شبکه با این دستور دارم دوتا فایل میخوام حذف کنم بعضی مواقع حذف میشه بعضی مواقع این خطا میده علت چی؟
کد HTML:
                 string[] filePaths =Directory.GetFiles(@"\\192.168.1.243\imageNEW\" + _melktype + @"\" + CodeDisplay);                        foreach (string filePath in filePaths)                            if (filePath.Contains(".jpeg"))                            {                                File.Delete(filePath);                            }
متن خطا این
کد HTML:
The process cannot access the file '\\192.168.1.243\imageNEW\Apartment\K\11K200\11K200-1.jpeg' because it is being used by another process.