Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Detecting Locked Files
Message
De
18/10/2005 18:18:18
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 1.1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Divers
Thread ID:
01059899
Message ID:
01060080
Vues:
15
>Hilmar,
>
>Thanks. That much I knew, but is that the best way? That just feels ... dirty ... to me. ;)

Any interaction with data outside the main program can easily fail for a variety of reasons. In this case: The file may not exist, you may not have access rights, or it may be blocked by another user. And probably a few others more; like: you want to write to the file, but the file is R/O.

So, it seems like a good idea to test for any possible exceptions anyway, not just because another user may have locked it.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform