Presentation is loading. Please wait.

Presentation is loading. Please wait.

Module 3: Using Microsoft.NET- Based Languages. Overview Overview of the.NET-Based Languages Comparison of the.NET-Based Languages.

Similar presentations


Presentation on theme: "Module 3: Using Microsoft.NET- Based Languages. Overview Overview of the.NET-Based Languages Comparison of the.NET-Based Languages."— Presentation transcript:

1 Module 3: Using Microsoft.NET- Based Languages

2 Overview Overview of the.NET-Based Languages Comparison of the.NET-Based Languages

3 Lesson: Overview of the.NET- Based Languages Multiple Language Support The Common Language Runtime The Common Language Runtime Components Runtime Compilation and Execution

4 Multiple Language Support The.NET Framework is designed to support many languages More than 20 languages currently supported Microsoft provides Visual Basic.NET, C#, Visual J#.NET, and JScript.NET Benefits of multiple-language support Code modules are reusable API access is the same for all languages The right language is used for the right task Performance is roughly equal between all languages

5 The Common Language Runtime One runtime for all. NET-Based Languages Manages threads and memory - Garbage collection Enforces code security - No uninitialized variables - Exception Handling Eliminates DLL versioning problems - Multiple versions of a DLL can run simultaneously - Applications can specify a version of a DLL to use

6 The Common Language Runtime Components.NET Framework Class Library Support Thread Support COM Marshaler Type Checker Exception Manager MSIL to Native CompilersCodeManagerGarbageCollector Security Engine Debug Engine Class Loader

7 Runtime, Compilation and Execution Native code C# code Visual Basic.NET code Which language? Visual Basic.NET compiler C# compiler MSIL JIT compiler default.aspx Runtime HTM L

8 Runtime, Compilation and Execution Language Compilation - A web browser request a Web page from a Web server that is running IIS. - The requested Web page, default.aspx, is compiled with the appropriate language compiler, depending on the language that is used to write the page. - The application is compiled to MSIL

9 Runtime, Compilation and Execution JIT Compilation - The MSIL is handled by the runtime. - The runtime uses a JIT compiler to compile the MSIL to native code. - After the application is JIT compiled, it is cached so that it does not need to be recompiled for each request.

10 Runtime, Compilation and Execution Application Execution - After the application is compiled, the runtime executes the application on the Web server and then generates the HTML and script that is returned to the client.

11 Lesson: Comparison of the.NET- Based Languages Visual Basic.NET C# Choosing a Language

12 Visual Basic.NET Visual Basic.NET is the latest version of Visual Basic True object-oriented language Visual Basic Scripting Edition (and JScript) are still used for client-side script Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim i As Integer = 0 Dim x As Double = TextBox1.Text For i = 0 To 4 x *= 2 Label1.Text = Label1.Text & x & "," Next End Sub Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim i As Integer = 0 Dim x As Double = TextBox1.Text For i = 0 To 4 x *= 2 Label1.Text = Label1.Text & x & "," Next End Sub

13 C# C# is a new language Similar to Java, Visual C++, and Pascal protected void Button1_Click(object sender, EventArgs e) { int i = 0; double x = Convert.ToDouble(TextBox1.Text); for (i=0; i<=4; i++) { x *= 2; Label1.Text = Label1.Text + x + ","; } protected void Button1_Click(object sender, EventArgs e) { int i = 0; double x = Convert.ToDouble(TextBox1.Text); for (i=0; i<=4; i++) { x *= 2; Label1.Text = Label1.Text + x + ","; }

14 Choosing a Language.NET Framework class library is the same regardless of language Performance All languages are compiled to MSIL Only performance difference is how each language compiler compiles to MSIL The runtime compiles all MSIL the same, regardless of its origin Development experience C# is similar to Java, C, Visual C++, and Pascal Visual Basic.NET is similar to Visual Basic Browser compatibility ASP.NET code is server-side code, so browser compatibility is not an issue

15 Review Overview of the.NET-Based Languages Comparison of the.NET-Based Languages

16 Exercise What role does the CLR play in running ASP.NET page? What is the role of JIT compilation? List FOUR languages that are currently supported by.NET. What is garbage collection and why is it so useful in the.NET Framework?

17 ~ End of Module 3 ~


Download ppt "Module 3: Using Microsoft.NET- Based Languages. Overview Overview of the.NET-Based Languages Comparison of the.NET-Based Languages."

Similar presentations


Ads by Google