One-Stop Programming
As you've seen throughout the first couple of chapters and in the "Hello, World" application, my examples have shown the methods of each class being defined within the class definition itself. This is not merely an exercise in convenience on my part, as C++ programmers might think. When programming in C++, you have two options: you can program the implementation of a class's member function directly into the class declaration-an example of inline programming-or you can separate the class declaration and its member function definitions into separate files. In C#, you do not have this choice.
When you define a class in C#, you must define all methods inline-header files do not exist. Why is this a good thing? It enables the writers of classes to create highly mobile code, which is one of the key concepts of the .NET environment. This way when you write a C# class, you end up with a fully encapsulated bundle of functionality that you can easily drop into any other development environment without worrying how that language processes include files or if it has a mechanism for including files within files. Using this "one-stop programming" approach, you can, for instance, take an entire class and drop it into an Active Server Pages (ASP) page and it will function just as it would if it were being compiled into a desktop Windows application! -