Code for Working with Files under a Directory?
Answer / murty
Suppose that you want to list all BMP files under the
f:\Pictures directory. You can write a code as shown in the
code snippet given in Listing 3:
Listing
DirectoryInfo dir = new DirectoryInfo(@"F:\WINNT");
FileInfo[] bmpfiles = dir.GetFiles("*.bmp);
Console.WriteLine("Total number of bmp files",
bmpfiles.Length);
Foreach( FileInfo f in bmpfiles)
{
Console.WriteLine("Name is : {0}", f.Name);
Console.WriteLine("Length of the file is : {0}",
f.Length);
Console.WriteLine("Creation time is : {0}",
f.CreationTime);
Console.WriteLine("Attributes of the file are : {0}",
f.Attributes.ToString());
}
Is This Answer Correct ? | 3 Yes | 1 No |
Code for Reading and writing from a file in c#?
Hello Sir, Thanks for the Solution but, can you pls. Explain the coding for the Static Function & static variable from the below coding....waiting for Ans. class fact { public static void Main() { fact f=new fact(); int x=1; //Declaration of x as 1 int k=Convert.ToInt32(Console.ReadLine()); for(int i=1;i<=k;i++) { x= x *i; } System.Console.WriteLine(x); } }
How to export 2 datatables of a single dataset to 2 different worksheets of a single MSExcel file ?
write a Program to copy the string using switch case.
Write a function which accepts a sentence as input parameter.Each word in that sentence is to be reversed. Space should be there between each words.Return the sentence with reversed words to main function and produce the required output. for eg:- i/p: jack jill jung kill o/p: kcaj llij gnuj llik
Write a program to count the number of characters, number of words, number of line in file.
Write a program to count 3Letter, 4Letter and 5Letter words from a file and print the number of 3Letter, 4Letter and 5Letter words. Delimiter is space, tab, hifen. Also we should not consider the line in the file after we encounter # in that line.
Code for Working with Files under a Directory?
Automatically Hyperlink URLs and E-Mail Addresses in ASP.NET Pages with C#
. Write a program to print the following outputs using for loops $ $ $ $ $ $ $ $ $ $ $ $ $ $ $
Coding for Manipulate XML File Data Using C#?
Coding for using Nullable Types in C#?