Tuesday, February 12, 2008

How to Get Information about File in c#.Net


FileInfo myfile = new FileInfo(@"H:\myphoto.jpg");

if (myfile.Exists)
Console.WriteLine("File name : {0}", myfile.Name);
Console.WriteLine("Path : {0}", myfile.FullName);
Console.WriteLine("Creation Time: {0}", myfile.CreationTime);
Console.WriteLine("Length : {0}", myfile.Length);

Note: "@" this symbol is used in string type to turn off escape processing. i.e If escape processing is turned on compiler will look for valid escape characters, if there is any invalid escape symbol it will throw compilation error.

No comments:

landscape paintings nature art landscape art sky art illustration art artwork art human art beautiful art landscape prints nature prints sky prints illustration prints artwork prints human prints beautiful prints beautiful special promotions nature special promotions sky special promotions illustration special promotions artwork special promotions beautiful canvas prints beautiful painting canvas prints beautiful framed prints beautiful painting framed prints beautiful posters beautiful painting posters