-
, Hello, World!. .
Microsoft Visual C# 2013 Express -> -> -> -> Console Application ( ) -> . *.cs . .
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace HelloWorld
{
class Program
{
static void Main(string[] args)
{
}
}
}
, .
Main, Hello, World! .
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace HelloWorld
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello, World!");
Console.ReadKey();
}
}
}
F5. , . -!
, , Program, () Main, , . Main , . Console.WriteLine("Hello, World!"); . , , , Console.ReadKey(); . .
, !
, , -
. . , , .
- . . , -:
sbyte | -128 127 | 8- |
byte | 0 255 | 8- |
char | U+0000 U+ffff | 16- Unicode |
bool | true false | 1 * |
short | -32768 32767 | 16- |
ushort | 0 65535 | 16- |
int | -2147483648 2147483647 | 32- |
uint | 0 4294967295 | 32- |
long | -9223372036854775808 9223372036854775807 | 64- |
ulong | 0 18446744073709551615 | 64- |
float | 1,5*10-45 3,4*1033 | 4 , 7 |
double | 5*10-324 1,7*10306 | 8 , 16 |
decimal | (-7,9 * 1028 7,9 * 1028) / (10028) | 16 , 28 |
|
|
* . - , . bool : 0 - false, 1 - true, - , , - .
, , :
static void Main(string[] args)
{
int a; // a int
a = 5; // a 5
int b, c; //
bool d; // d bool
d = true; // d true ()
long e = 10; // ,
float f = 5.5f; // float, f.
char g = 'g'; // g 'g'
}
, , "Use of unassigned local variable [variableName]".
static void Main(string[] args)
{
int a;
Console.WriteLine(a); //
}
- . max Max . , .
, . a, b, c. . height, age . .
.