Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to .NET Framework

Similar presentations


Presentation on theme: "Introduction to .NET Framework"— Presentation transcript:

1 Introduction to .NET Framework
Po Feng, Tsai

2 How a program is composed and executed
Written by you but executed by a machine (computer) For programmers C,C++,Fortran,Basic For machines Architecture dependent instruction set (in binary forms) Translation is required

3 How a program is composed and executed
Source Codes Compiler Assembler Object Codes Linker Loader Assembly Codes Hardware Architecture

4 Problems for a programmer
Platform dependent Windows ? Linux ? Architecture dependent X86 ? ARM? PPC? Interfacing with each others An isolated virtual framework layer

5 The .NET Framework To provide a convenient and united development and execution environment C#, VB.NET, C++.NET & Jscript.NET CLR (Common Language Runtime) FCL (framework class library) Languages integration CTS (Common Type System) CLS (Common Language Specification) CLR

6 The .NET Framework Framework class library
Lower level: (Base class library) Core data type (integer, string, float, object) Fundamental constructs (collection, I/O …) Access to resources (Networking, file system…) Interface to core execution (Threading, debugging …) Upper level: SQL ADO.NET XML Web services

7 The .NET Framework

8 Compilation Source codes are compiled into MSIL (MS Intermediate Language) for the first step Metadata is used to keep the content information, such as parameters, methods, of the file

9 Execution CLR is the execution engine of .NET framework application
Virtual machine It manages the following services Code management Memory management Conversion IL into native code Exception handling Debugging

10 Compilation & Execution

11 JIT (Just In Time) Very popular technique used in various virtual machines Machine codes are generated Fast Compiles as needed

12 Introduction to C# Po Feng, Tsai

13 Getting started Visual C# 2005 Express
System Requirements: Processor Minimum: 600 megahertz (MHz) Pentium processor Recommended: 1 gigahertz (GHz) Pentium processor RAM Minimum: 192 megabytes (MB) Recommended: 256 MB Hard Disk: Up to 1.3 GB of available space may be required

14 About C# C# is announced in July 2000
C# includes the support for structured, component-based, object-oriented programming Very easy to use Modern programming

15 Example 1: HelloWorld In the console window: Hello World

16 The Class A type defines a thing including its properties and behaviors A class is used to define a new type Blueprints

17 The Method Behaviors are defined by methods
A method is a function owned by your class Defines what you can do or how it behaves Usually you can tell what it is for from its name WriteLine()

18 The Method Declare a method The program entry function Keyword: void
Main() The program ends when Main() exits

19 The comments You can add your own comments by // /* ……… */
/// (used by Visual Studio)

20 Namespace Tremendous number of types of the .NET Framework Class Library Each class in C# must have a unique name Name collision Example (two engineers) Jim: Science.software.engineer Charlotte: transportation.train.engineer System.Console.WriteLine(); Keyword: using using System; using System.Console; (does not compile !)

21 Console object This is a console program
No GUIs Monitor is managed by an Console object It has many behaviors (methods) WriteLine() Write() Console.WriteLine()

22 The Dot operator ( . ) You can use the dot operator to access a method (or data) of a class or object You can use the dot operator to specify the sub-namespace Please keep in mind: C# is case-sensitive

23 The static keyword It is used to indicate that you can invoke Main() without first creating an object of type HelloWorld This issue will be covered in later sections

24 Developing the HelloWorld
Console mode (start  cmd) Need .NET Framework SDK csc HelloWorld Use Visual Studio .NET (Integrated Development Environment)

25 Using VS .NET File  New  Project Select “Console Application”

26 Using VS .NET

27 Compile & Run Compile Run Build  Build Solution Ctrl+shift+B
Debug  Start Without Debugging F5 (debug) or Ctrl-F5

28 HelloWorld.exe Contains op-codes written in MSIL Read-only segment
Inserted with standard win32 executable header Jumps to the JIT compiler JIT compiler Generating native instructions (like a normal exe file)

29


Download ppt "Introduction to .NET Framework"

Similar presentations


Ads by Google