Overview of the Microsoft .NET Framework

Page created by Vernon Kennedy
 
CONTINUE READING
Overview of the Microsoft .NET
         Framework
Overview

   Overview of the Microsoft .NET Framework
   Overview of Namespaces
• Overview of the Microsoft .NET
      Framework

   The .NET Framework
   Common Language Runtime
   The .NET Framework Class Library
   ADO.NET: Data and XML
   What is an XML Web Service?
   Web Forms and Services
The .NET Framework

     VB   C++   C#   Perl   Python   …
Common Language Runtime
The .NET Framework Class Library

   Spans All Programming Languages
      Enables cross-language inheritance and debugging
      Integrates well with tools

   Is Object-Oriented and Consistent
      Enhances developer productivity by reducing the
        number of APIs to learn

   Has a Built-In Common Type System

   Is Extensible
      Makes it easy to add or modify framework features

   Is Secure
      Allows creation of secure applications
ADO.NET: Data and XML

  System.Data       System.Xml
What Is an XML Web Service?

   Provide a Directory of Services on the Internet

   XML Web services are defined in terms of the
    formats and ordering of messages

   XML Web services consumers can send and
    receive messages using XML

   Built using open Internet protocols
Web Forms and Services

         Description   HtmlControls

         Discovery     WebControls

         Protocols
• Overview of Namespaces

   Namespaces
   Namespaces Used in this Course
   Namespaces Covered in Optional Modules
Namespaces
Introduction to a Managed
 Execution Environment
Overview

   Writing a .NET Application
   Compiling and Running a .NET Application
• Writing a .NET Application

   Using a Namespace
   Defining a Namespace and a Class
   Entry Points, Scope, and Declarations
   Console Input and Output
   Case Sensitivity
Using a Namespace

   Classes Can Be Fully Referenced
        // declares a FileStream object
        System.IO.FileStream aFileStream;

   Or the Namespace of a Class Can Be
    Referenced
      No need to fully qualify contained class names

       using System.IO;
             ...
       FileStream aFileStream;
Defining a Namespace and a Class

   C# Supports Creation of Custom Namespaces and
    Classes Within Those Namespaces

    namespace CompCS {
          public class StringComponent {
                      ...
          }
    }
Entry Points, Scope, and Declarations
   In C#, the External Entry Point for a Program Is in a Class
     class MainApp
     { public static void Main()
        {. . .}
     }

   C# Supports the Use of a Period As a Scope Resolution
    Operator

      Console.WriteLine ("First String");

   In C#, Objects Must Be Declared Before They Can Be Used
    and Are Instantiated Using the New Keyword

     Lib.Comp myComp = new Lib.Comp();
Console Input and Output

   Console Class Methods
      Read, ReadLine, Write, and WriteLine

    Console.WriteLine("Hello World using C#!");
Case Sensitivity

   Do Not Use Names That Require Case
    Sensitivity
      Components should be fully usable from both

       case-sensitive and case-insensitive languages
      Case should not be used to distinguish

       between identifiers within a single name
       scope
   Avoid the Following
                         class customer {...}
                         class Customer {...}

                         void foo(int X, int x)
• Compiling and Running a .NET
    Application
   Compiler Options
   The Process of Managed Execution
   Metadata
   Microsoft Intermediate Language
   Assemblies
   Common Language Runtime Tools
   Just-In-Time Compilation
   Application Domains
   Garbage Collection
Compiler Options

     Compile Directly from a Command Prompt
      Window
                 >csc HelloDemoCS.cs

     Use /t to indicate target
            >csc /t:exe HelloDemoCS.cs

     Use /reference to reference assemblies

>csc /t:exe /reference:assemb1.dll HelloDemoCS.cs
The Process of Managed Execution
                                               EXE/DLL               Source
                                              (MSIL and   Compiler
                                                                      Code
                                              metadata)

   Class
 Libraries
(MSIL and
metadata)

              Trusted,                      Call to an
                            Managed
             pre-JITed       Native
                                           uncompiled
             code only       Code            method

                           Execution

                         Security Checks
                                                   Runtime Engine
Metadata

   Declarative Information Emitted at Compile Time
   Included with All .NET Framework Files and
    Assemblies
   Metadata Allows the Runtime to:
      Load and locate code

      Enforce code security

      Generate native code at runtime

      Provide reflection
Microsoft Intermediate Language

   Produced by Each Supported Language Compiler
   Converted to Native Language by the Common
    Language Runtime's JIT Compilers
Assemblies
  Managed Module
(MSIL and Metadata)

  Managed Module
(MSIL and Metadata)                         Assembly

                                            Manifest
     .html

        .gif
                      Multiple Managed
                      Modules and
  Resource Files      Resource Files
                      Are Compiled to
                      Produce an Assembly
Common Language Runtime Tools

   Runtime Utilities for Working with MSIL
      MSIL Assembler (ilasm.exe) produces a final

       executable binary
      MSIL Disassembler (ildasm.exe) inspects

       metadata and code of a managed binary
Just-In-Time Compilation

   Process for Code Execution
      MSIL converted to native code as needed

      Resulting native code stored for subsequent calls

      JIT compiler supplies the CPU-specific conversion
Application Domains

   Historically, Process Boundaries Used to Isolate
    Applications

   In the Common Language Runtime, Application Domains
    Provide Isolation Between Applications
      The ability to verify code as type-safe enables isolation

        at a much lower performance cost
      Several application domains can run in a single process

   Faults in One Application Cannot Affect Other Applications
Garbage Collection

   Garbage Collection Provides Automatic Object
    Memory Management in the .NET Framework

   You No Longer Need to Track and Free Object
    Memory
You can also read