Hi
I want to get the file size of a file.
Read in other topic you need to use the code shown on this page: http://msdn.microsoft.com/en-us/library/system.io.fileinfo.length.aspx
Tried to use the example, but doesn't seem to work.
I know little about C code so there's probably a lot wrong. But maybe somebody could point me in the right direction?
I want to get the file size of a file.
Read in other topic you need to use the code shown on this page: http://msdn.microsoft.com/en-us/library/system.io.fileinfo.length.aspx
Tried to use the example, but doesn't seem to work.
Код:
using System;
using System.IO;
public class FileLength
{
public static void Main()
{
DirectoryInfo di = new DirectoryInfo("{-Project.Directory}");
// Get a reference to each file in that directory.
FileInfo[] fiArr = di.GetFiles();
// Display the names and sizes of the files.
Console.WriteLine("The directory {0} contains the following files:", di.Name);
foreach (FileInfo f in fiArr)
Console.WriteLine("The size of {0} is {1} bytes.", f.Name, f.Length);
}
}