About 27,500,000 results
Open links in new tab
  1. What is the difference between File and FileInfo in C#?

    File is optimized for one-off operations on a file, FileInfo is optimized around multiple operations on the same file, but in general there isn't that much difference between the different method …

  2. c# - Getting file names without extensions - Stack Overflow

    Jan 26, 2011 · I dislike the DirectoryInfo, FileInfo for this scenario. DirectoryInfo and FileInfo collect more data about the folder and the files than is needed so they take more time and …

  3. How can I get the FileInfo of all files in a folder with GetFile()?

    FileInfo[] files = dir.GetFiles(); Also I suggest you to use Path.Combine for generating new file path and FileInfo.MoveTo method, which don't require source directory name:

  4. What is difference between File.Exists("") and FileInfo exists

    Feb 26, 2014 · 2 The difference between File.Exists() and new FileInfo().Exists on it's behavior when full path (directory name + file name) is long:

  5. How to use FileInfo object from Powershell - Stack Overflow

    May 4, 2017 · 3 You can use Get-Item to allow PowerShell to select between FileInfo and DirectoryInfo. It will throw an exception if the path doesn't resolve to a location.

  6. .net - System.IO.FileInfo and Relative Paths - Stack Overflow

    Dec 7, 2021 · The underlying problem is that System.IO .NET methods, including the [System.IO.FileInfo]::new() constructor you're (implicitly) invoking, use …

  7. filesize - How do you get the file size in C#? - Stack Overflow

    I need a way to get the size of a file using C#, and not the size on disk. How is this possible? Currently I have this loop foreach (FileInfo file in downloadedMessageInfo.GetFiles()) { //file.

  8. How to get Size of file in FileInfo? - Stack Overflow

    Jan 25, 2016 · FileInfo fileInfo = new FileInfo(path); long fileLength = fileInfo.Length; would give the size of the file. It is better to check whether the file exists or not before getting the size to …

  9. How do I get the directory from a file's full path? - Stack Overflow

    If you are working with a FileInfo object, then there is an easy way to extract a string representation of the directory's full path via the DirectoryName property.

  10. Can I show file copy progress using FileInfo.CopyTo() in .NET?

    My problem is related to copying large files. I've been unable to find a way to indicate the total copy progress of a large file (using my current class structure that utilitzes FileInfo.CopyTo …