Sams Teach Yourself Visual C# 2005 in 24 Hours, Complete Starter Kit

Quiz

1.

True or False: The Open File dialog box automatically opens a file.

2.

What symbol is used to separate a filter description from its extension?

3.

What Namespace is used to manipulate files?

4.

What arguments are expected by System.IO.File.Copy()?

5.

How would you rename a file?

6.

True or False: Files deleted with System.IO.File.Delete() are sent to the Recycle Bin.

7.

What object is used to manipulate folders?

Answers

1.

False

2.

The Pipe symbol (|)

3.

System.IO

4.

The name and path of the source file and a name and path for the copy.

5.

Use the Move() method while retaining the path.

6.

False. The files are permanently deleted.

7.

System.IO.Directory

Exercises

1.

Create a project that enables a user to select a file with the Open Dialog control. Store the filename in a text box. Provide another button that, when clicked, creates a backup of the file by making a copy of it with the extension .bak.

2.

Create a project with a text box on a form in which the user can type in a three-digit file extension. Include a button that shows an Open File dialog box when clicked, with the filter set to the extension entered by the user.

Категории