Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
DotNETFrameworkNotesForProfessionals.pdf
Скачиваний:
34
Добавлен:
20.05.2023
Размер:
1.82 Mб
Скачать

Chapter 1: Getting started with .NET Framework

.NET

Version Release Date

1.0

2002-02-13

1.1

2003-04-24

2.0

2005-11-07

3.0

2006-11-06

3.5

2007-11-19

3.5 SP1

2008-08-11

4.0

2010-04-12

4.5

2012-08-15

4.5.1

2013-10-17

4.5.2

2014-05-05

4.6

2015-07-20

4.6.1

2015-11-17

4.6.2

2016-08-02

4.7

2017-04-05

4.7.1

2017-10-17

Compact Framework

Version Release Date

1.02000-01-01

2.02005-10-01

3.52007-11-19

3.72009-01-01

3.92013-06-01

Micro Framework

Version Release Date

4.22011-10-04

4.32012-12-04

4.42015-10-20

Section 1.1: Hello World in C#

using System;

class Program

{

// The Main() function is the first function to be executed in a program static void Main()

{

// Write the string "Hello World to the standard out

Console.WriteLine("Hello World");

}

}

Console.WriteLine has several overloads. In this case, the string "Hello World" is the parameter, and it will output

the "Hello World" to the standard out stream during execution. Other overloads may call the .ToString of the

GoalKicker.com – .NET Framework Notes for Professionals

2

argument before writing to the stream. See the .NET Framework Documentation for more information.

Live Demo in Action at .NET Fiddle

Introduction to C#

Section 1.2: Hello World in F#

open System

[<EntryPoint>] let main argv =

printfn "Hello World" 0

Live Demo in Action at .NET Fiddle

Introduction to F#

Section 1.3: Hello World in Visual Basic .NET

Imports System

Module Program

Public Sub Main()

Console.WriteLine("Hello World")

End Sub

End Module

Live Demo in Action at .NET Fiddle

Introduction to Visual Basic .NET

Section 1.4: Hello World in C++/CLI

using namespace System;

int main(array<String^>^ args)

{

Console::WriteLine("Hello World");

}

Section 1.5: Hello World in IL

.class public

auto ansi beforefieldinit Program

extends [mscorlib]System.Object

{

 

 

.method public hidebysig static void Main() cil managed

{

 

 

.maxstack

8

 

IL_0000:

nop

 

IL_0001:

ldstr

"Hello World"

IL_0006:

call

void [mscorlib]System.Console::WriteLine(string)

IL_000b:

nop

 

IL_000c:

ret

 

}

 

 

 

 

 

 

 

 

GoalKicker.com – .NET Framework Notes for Professionals

3

.method public hidebysig specialname rtspecialname instance void .ctor() cil managed

{

.maxstack 8 IL_0000: ldarg.0 IL_0001: call IL_0006: ret

}

instance void [mscorlib]System.Object::.ctor()

}

Section 1.6: Hello World in PowerShell

Write-Host "Hello World"

Introduction to PowerShell

Section 1.7: Hello World in Nemerle

System.Console.WriteLine("Hello World");

Section 1.8: Hello World in Python (IronPython)

print "Hello World"

import clr

from System import Console Console.WriteLine("Hello World")

Section 1.9: Hello World in Oxygene

namespace HelloWorld;

interface

type

App = class public

class method Main(args: array of String); end;

implementation

class method App.Main(args: array of String); begin

Console.WriteLine('Hello World'); end;

end.

Section 1.10: Hello World in Boo

print "Hello World"

GoalKicker.com – .NET Framework Notes for Professionals

4