By Jesse Liberty, Brian MacDonald
Price: $39.99 USD
£28.50 GBP
Cover | Table of Contents
http://msdn.microsoft.com/library).if, while, and for. You'll learn about these keywords in the coming chapters.
namespace NotePad
{
class HelloWorld
{
// every console app starts with Main
static void Main( )
{
System.Console.WriteLine("Hello world!");
}
}
}http://msdn.microsoft.com/vstudio/express/visualcsharp/.http://www.mono-project.com) and SharpDevelop (http://www.icsharpcode.net/OpenSource/SD/
namespace NotePad
{
class HelloWorld
{
// every console app starts with Main
static void Main( )
{
System.Console.WriteLine("Hello world!");
}
}
}
csc HelloWorld.cs
csc helloworld.cs
namespace NotePad
{}). Thus, the second line of the Hello World program is an open brace to mark the beginning of the NotePad namespace. The open brace is matched by a closing brace at the end of the program.
Console.Writeline( ) statement in Hello World. Navigate away from it and then use the bookmarks menu item to return to it.for loop from the Edit → Intellisense menu into your Hello World program. (It won't do anything for now; you'll learn about for loops in Chapter 4.)
int myVariable; // a statement
myVariable = 23; // another statement
int anotherVariable = myVariable; // yet another statement
int myVariable; // a statement
myVariable = 23; // another statement
int anotherVariable = myVariable; // yet another statement|
C# type
|
Size (in bytes)
|
.NET type
|
Description
|
|---|---|---|---|
byte
|
1
|
Byte
|
Unsigned (values 0-255).
|
char
|
2
|
Char
|
Unicode characters.
|
bool
|
1
|
Boolean
|
True or false.
|
sbyte
|
1
|
SByte
|
Signed (values -128 to 127). |
int) that can hold a value:
int myVariable = 15;myVariable.
int myVariable;myVariable later in your program:
int myVariable;
// some other code here
myVariable = 15; // assign 15 to myVariable
int myVariable;
// some other code here
myVariable = 15; // assign 15 to myVariable
// some other code here
myVariable = 12; // now it is 12myVariable.