C#
  Home arrow C# arrow Page 6 - Introducing C# and the .NET Framework
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
C#

Introducing C# and the .NET Framework
By: Michael Youssef
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 87
    2005-01-31

    Table of Contents:
  • Introducing C# and the .NET Framework
  • The .NET Framework
  • C# Source code
  • The .NET Type Story
  • A World of .NET
  • The Common Language Runtime
  • The Common Type System
  • A World of Interoperability Through the CLS
  • Where Can I Find the .NET SDK?
  • Writing the Hello World Example with the C# Compiler
  • Assemblies
  • Analyzing the Code

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Introducing C# and the .NET Framework - The Common Language Runtime


    (Page 6 of 12 )

    The concept of the Runtime Environment is not new. Developers used to programming using Microsoft Foundation Classes (MFC) know that a runtime environment is needed to manage their applications. Java also has a runtime environment (the Java Virtual Machine), but C#, Visual Basic.NET, Managed C++ and all the other Microsoft.NET Compliant Languages have only one runtime environment between them, which is the Common Language Runtime. The CLR is the part of the .NET Framework that executes and manages any .NET Application, and as you know, the code produced by all .NET Compliant languages is MSIL and it's called managed code.

    The CLR understands only MSIL (not C#, not Visual Basic.NET) so whatever the language has been used to produce the MSIL Instructions is not an issue for the CLR. The Interesting thing about the CLR is that it's loaded automatically each time you execute a .NET application, and it's represented as an assembly file (an assembly is a unit of deployment in .NET) called mscoree.dll (stands for Microsoft Common Object Execution Engine). It is needed on the machines that will run a .NET application, so you need to make certain your clients have the CLR installed. You can install it using the .NET Framework distribution components.

    I like to think of the CLR as a monitor, guard and a supervisor for all .NET Applications. I say that because it's responsible for:

    • Compiling the MSIL instructions to native CPU instructions. As you know, .NET language's compilers produce files that contain MSIL code, and for execution of your application the CLR uses its JIT Compiler to compile the MSIL Instructions to native CPU instructions, and to optimize these instructions to utilize the process features.

    • Managing memory automatically for your applications using a Garbage Collection mechanism. This guarantees that objects that have no reference in your application will be freed, and you as the developer will not worry about releasing memory for objects. This guarantees faster performance and, at the same time, gives you the time to focus on the development issues of your applications.

    • Handling application errors when required by throwing an Exception.

    • Guaranteeing that your .NET Applications will run in a safe context by using a mechanism called Code-Access Security. There is another security mechanism called Role-Based Security which controls the access to system recourses. Using .NET Security that is managed by the CLR, you can develop very secure applications.

    • Knowing what files are needed to execute your application (these are the assemblies that represent the .NET Framework Class Library). It uses an algorithm to search for these files. The simplest C# program must refer to and use one assembly that contains most of the basic functionality, such as methods to write and read lines from and to the Console.

    • Beginning a process called Code Verification. When the JIT Compiler begins to compile the MSIL Instructions to native CPU Instructions, this process checks type safety. In other words it ensures that your code doesn't make any illegal operations or allow any illegal access, and this is where the expression that "C# is a Type-Safe Language" comes from.

    More C# Articles
    More By Michael Youssef


     

    C# ARTICLES

    - Coding a CRC-Generating Algorithm in C
    - Cyclic Redundancy Check
    - Handling Methods and Functions
    - Destroying Objects in C#
    - Creating Objects in C-Sharp
    - Classes and Objects
    - Programming Languages: Managed versus Native
    - LINQ-to-MySQL with DbLinq in C#
    - Working with Dates and Times in C#
    - Generics, Dictionaries, and More
    - More About Generics
    - Working with C# Collections
    - Generics
    - C# and XML
    - Pointers and Arrays in C#





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek