1. Trang chủ
  2. » Công Nghệ Thông Tin

Tài liệu DotNetOverview docx

23 117 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề .NET Overview
Thể loại Presentation
Định dạng
Số trang 23
Dung lượng 118 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

development platform servers services.NET Overview • .NET is a sweeping marketing term for a family of products – development tools and languages Visual Studio .NET Common Language Runti

Trang 1

.NET Overview

Trang 2

– development and execution model

• Examine simple C# program

Trang 3

development platform servers services

.NET Overview

• NET is a sweeping marketing term for a family of products

– development tools and languages

Visual Studio NET

Common Language Runtime Framework Libraries SQL Server BizTalk

SharePoint

My Services Alerts

Passport

Trang 4

Evolution of the platform

• NET is the next evolutionary step for the Microsoft platform

– new languages largely replace classic C++ and Visual Basic

– new runtime model reduces need for COM style integration

– XML web services used in place of DCOM

– Windows Forms replace MFC

– ASP.NET improves on ASP

– etc

Trang 7

Language power

• All languages can access NET infrastructure

C#

class Hello {

static void Main() {

System.Console.WriteLine ("hello");

} }

VB.NET

Class Goodbye

Shared Sub Main() System.Console.WriteLine ("goodbye") End Sub

End Class

Trang 8

static void Main() {

System.Console.WriteLine(Greeting.Message());

} }

Class Greeting Shared Function Message() As String Return "hello"

End Function End Class

Trang 9

VB.NET

Language variability

• Not all NET languages have exactly the same capabilities

– differ in small but important ways

class Hello {

static void Main() {

int i;

uint u;

} }

Class Greeting Shared Sub Main() Dim i as Integer End Sub

signed integer

unsigned integer

signed integer only

Trang 10

Common Language Specification

• Common Language Specification (CLS) defines type subset

– required to be supported by all NET languages

– limiting code to CLS maximizes language interoperability

– code limited to CLS called CLS compliant

public class Calculator {

public uint Add(uint a, uint b) {

return a + b;

} }

not CLS compliant

to use uint in public

interface of public class

Trang 11

.NET Framework class library

Library

• Extensive set of standard libraries available

– for wide range of application types

– called NET Framework class library

Collections

Web development

Input/Output

Database access Windows Forms GUI

Networking

XML processing

Threading Reflection

Debugging

Trang 13

Calc c = new Calc();

int sum = c.Add(2, 4);

C# compiler

Trang 15

JIT runtime compile

• IL is compiled into machine code at runtime by the CLR

– compiles methods as needed

– called just in time (JIT) compile

• JIT compilation model:

– first time method is called the IL is compiled and optimized

– compiled machine code is cached in transient memory

– cached copy used for subsequent calls

IL code F() G()

JIT runtime

machine code for F()

Trang 16

NGEN install time compile

• Can compile IL into machine code when app installed

– use native image generator ngen.exe

– can speed startup time since code pre-compiled

– but cannot do as many optimizations

– original IL must still be available for type information

CLR

cache

machine code

Trang 17

Execution command

• CLR automatically invoked when NET application executed

C:\> MyApp hello

execute

Trang 18

Required CLR

• CLR and NET Framework required to run NET app

– will be incorporated into Windows and service packs

– developers install as part of NET Framework SDK

– users can run dotnetredist.exe

Trang 19

C# program

• C# program basics

– source file has cs extension

– namespace used to group related types

– class defines new type

– Main is application entry point

– WriteLine writes output

– { and } delimit code block

namespace MyNamespace {

class MyApp {

static void Main() {

System.Console.WriteLine("hello");

} }

Trang 20

Building console executable

• Can use C# compiler to build console executable

– use /t[arget]:exe

– use /out:<name> to specify output file name

• Default values can simplify use

– default target type is console executable

– default name adds exe to base name of file containing Main

C:\> csc /target:exe /out: MyApp.exe MyApp.cs

Trang 21

Building Windows executable

• Can use C# compiler to build windows executable

– use /t[arget]:winexe

C:\> csc /target:winexe MyWinApp.cs

build Windows

application

Trang 22

Building library

• Can use C# compiler to build library

– use /t[arget]:library

• Controlling output file name:

– can use /out:<name> to specify output file name

– default: adds dll to base name of first input file

C:\> csc /target:library /out: MyLib.dll MyLib.cs

create

library

Trang 23

• NET requires multiple steps to develop and run software

– code in one of the many NET languages

– compile into IL

– install the CLR

– execute

• CLR JIT compiles IL at runtime

– always executes compiled code

– never interpreted

• Can target CLS compliance

– to maximize language interoperability

Ngày đăng: 25/01/2014, 15:20

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

w