|
|
|
Introduction to the Base Class Library
The Base Class Library (BCL), provides a ton of
code that you as a developer can leverage to build your
applications. The BCL is
Table 2.2. An FCL Overview
Table 2.2 does not give a complete namespace listing, but instead lists some of the most commonly used namespaces. |
|
|
|
|
|
|
The Canonical "Hello World" Example
I'm
Begin by staring Visual Studio .NET and
selecting File, New Project. Next, select a C# console application
and
Figure 2.3. Creating a .NET console application for Hello World.
Visual Studio .NET will create a default source
file,
Class1.cs
, and provide some basic
Listing 2.4. Generated Boilerplate Code for a C# Console Application
using System;
namespace Hello_World
{
/// <summary>
/// Hello World example
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
Replace lines 16 though 18
Console.WriteLine( "Hello World" ); The Main method should now look like Listing 2.5. Listing 2.5. Updated Main Method Replacing Comments with Code
1: static void Main(string[] args)
2: {
3: Console.WriteLine( "Hello World" );
4: }
The Console.WriteLine method will print the string Hello World to a console window. Figure 2.3 shows the results from executing the code. To execute the code, select Debug, Start Without Debugging or simply press Ctrl+F5 to launch the application. |
|
|
|