It’s rare for a useful program to be so simple that you would want all of its source code in one file. You may occasionally stumble across horrors such as a single file containing tens of thousands of lines of code, but in the interest of quality (and sanity) it’s best to try to keep your source code in smaller, more manageable chunks—the larger and more complex anything gets the more likely it is to contain flaws. So Visual Studio is built to work with multiple source files, and it provides a couple of concepts for structuring your programs across those files: projects and solutions.
A project is a collection of source files that the C# compiler
combines to produce a single output—typically either an executable program
or a library. (See the sidebar on the next page for more details on the
compilation process.) The usual convention in Windows is that executable
files have an .exe extension while
libraries have a .dll extension. (These
extensions are short for executable and
dynamic link library, respectively.) There isn’t a
big difference between the two kinds of file; the main distinction is that
an executable program is required to have an entry point—the
Main function. A library is not something you’d run independently; it’s designed to be used by other programs, so a DLL doesn’t have its own entry point. Other than that, they’re pretty much the same thing—they’re just files that contain code and data. (The two types of file are so similar that you can ...