It's dangerous to code alone! Take this.

Knowledge Check - Large Programs

1. True/False. A using directive makes previously inaccessible code accessible.

False. It does not change what is accessible; it only makes it easier to access code you could already access by removing the need for fully-qualified names.

2. True/False. A using directive makes it so that you do not need to use fully qualified names.

True. This is the purpose of using directives.

3. True/False. Two types are allowed to have the same simple name.

True. And it is because of this fact that makes using directives important. That is what drives the need to use namespaces, which then make using directives useful.

4. True/False. A name collision is when two types have the same name.

True. Name collisions happen when two types that you are attempting to use in a file share the same simple name.

5. Name two ways to resolve a name collision.

Fully qualified names avoid name collisions by using names that allow the compiler to tell which one you are referring to.

Aliases allow you to tell the compiler ahead of time which of several types you are referring to with a simple name.

6. True/False. Local functions must always go after all statements in the method.

False. Local functions can be intermixed with statements from the containing method in any order. However, for best results, you should either place local functions at the bottom, after all statements, or first, before all statements. My personal preference is to put them after all statements, and that is what I have done in the book for all top-level statement main methods.

7. True/False. You should always use top-level statements for the entry point of a program.

False. Top-level statements mean you don’t need to explicitly write out public static void Main, which is convenient, but ultimately this comes down to personal preference. Top-level statements are fairly new to C#, so you will see a lot of the traditional approach on the Internet.