snippetcsharpCritical
How do you get the file size in C#?
Viewed 0 times
youhowthefilesizeget
Problem
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
Will this return the size or the size on disk?
Currently I have this loop
foreach (FileInfo file in downloadedMessageInfo.GetFiles())
{
//file.Length (will this work)
}Will this return the size or the size on disk?
Solution
FileInfo.Length will return the length of file, in bytes (not size on disk), so this is what you are looking for, I think.Context
Stack Overflow Q#1380839, score: 448
Revisions (0)
No revisions yet.