System.IO.File.Exists C# (CSharp) Méthode

Exists() public static méthode

public static Exists ( string path ) : bool
path string
Résultat bool
        public static bool Exists(string path) { throw null; }
        public static System.IO.FileAttributes GetAttributes(string path) { throw null; }

Same methods

File::Exists ( String path ) : bool

Usage Example

Exemple #1
0
 public ImageSource Extract(File file)
 {
     try {
         if (new List<string> {".ico", ".png", ".jpg", ".gif"}.Contains(file.Extension.ToLower())) {
             if (!file.Exists()) return new BitmapImage();
             return new BitmapImage(new Uri(file.FullName));
         }
         Icon icon = ExtractIcon(ActualFile(file));
         Bitmap bmp = icon.ToBitmap();
         DestroyIcon(icon.Handle);
         var strm = new MemoryStream();
         bmp.Save(strm, ImageFormat.Png);
         return Extract(strm);
     }
     catch (ExternalException exception) {
         LogManager.WriteLog(exception);
         return new BitmapImage();
     }
     catch (DirectoryNotFoundException exception) {
         LogManager.WriteLog("Requested file: {0}", file);
         LogManager.WriteLog(exception);
         return new BitmapImage();
     }
     catch (ArgumentException exception) {
         LogManager.WriteLog("Requested file: {0}", file);
         LogManager.WriteLog(exception);
         return new BitmapImage();
     }
 }
All Usage Examples Of System.IO.File::Exists