CHAPTER 1 THE PHILOSOPHY OF .NET
Public Module MyApp
Sub Main()
Console.WriteLine("Hi from VB")
End Sub
End Module
// Hello world in C++/CLI.
#include "stdafx.h"
using namespace System;
int main(array ^args)
{
Console::WriteLine(L"Hi from C++/CLI");
return 0;
}
Notice that each language is making use of the Console class defined in the System namespace.
Beyond some obvious syntactic variations, these three applications look and feel very much alike, both
physically and logically.
Clearly, your primary goal as a .NET developer is to get to know the wealth of types defined in the
(numerous) .NET namespaces. The most fundamental namespace to get your hands around initially is
named System. This namespace provides a core body of types that you will need to leverage time and
again as a .NET developer. In fact, you cannot build any sort of functional C# application without at least
making a reference to the System namespace, as the core data types (e.g., System.Int32, System.String)
are defined here. Table 1-3 offers a rundown of some (but certainly not all) of the .NET namespaces
grouped by related functionality.
Table 1-3. A Sampling of .NET Namespaces
24
.NET Namespace
Meaning in Life
System
Within System, you find numerous useful types dealing with
intrinsic data, mathematical computations, random number
generation, environment variables, and garbage collection, as well
as a number of commonly used exceptions and attributes.
System.Collections
System.Collections.Generic
These namespaces define a number of stock container types, as
well as base types and interfaces that allow you to build
customized collections.
System.Data
System.Data.Common
System.Data.EntityClient
System.Data.SqlClient
These namespaces are used for interacting with relational
databases using ADO.NET.
System.IO
System.IO.Compression
System.IO.Ports
These namespaces define numerous types used to work with file
I/O, compression of data, and port manipulation.
(0