Introduction To Programming C#
Introduction To Programming C#
Net
Lecture 1
Objectives
• Introduce basic computing concepts
• The .NET framework
• Overview of C#
• The elements of a C# program
• Compiling and running C# program
• Developing a C# program
Introduction to Computing
• Hardware:
Introduction to Computing
• Software
– Programs the computer executes
– The OS provides an interface to the computer
hardware for us
– Businesses rely on computer software to serve
customers
Introduction to Computing
• Software
– Processor executes software using instruction sets
– Instruction sets are simple
– A simple task on the software may require many
lines of instructions
Introduction to Computing
• Each instruction has:
• operation (e.g., addition),
• operands (numbers to add) and
• memory numerical address (to store or retrieve data from)
• Each instruction performs a load, store or
addition
• Too many instructions for a simple task
• Same thing has to be repeated for another
different processor
Introduction to Computing
• High level languages allows us to:
– Combine several steps into one expression
– Write programs for many types of processors
• Compiler compiles high level language (source
code) and converts it into executable code
suitable for particular processor
The .Net Framework
• Microsoft developed the C# language along
with the .Net framework
• The .Net framework was designed to fulfill the
following objectives:
– Object oriented programming environment
– Code execution environment to minimize software
deployment and versioning conflict
– Code execution environment that guarantees safe
execution of code
The .Net Framework
– Code execution environment that eliminates the
performance problem of scripted or interpreted
environments
– To make developer experience consistent across
widely varying types of applications
– To build all communication on industry standards
so that code based on the .Net framework can
integrate with any other code
The .NET Framework
Two main parts
• Common Language Runtime (CLR)
– manages execution of code and
– provides services to make the execution of code
easier
• .NET Framework Class Library provides a
large set of types to speed up the
development process
The Common Language Runtime(CLR)
• Code that uses CLR are called managed code
– VB.Net uses CLR
• Common Type System
– defines the types of data that managed code can
use.
• Common Language Specification (CLS)
– defines features that every language for
developing managed code must provide
The Common Language Runtime(CLR)
• There are many different types of processors that
run code
• To work in the different types of devices you can
translate the program to the native instruction
set for that device
• The other approach, which is used by CLR:
– compile the source code into an intermediate
language
– during runtime the CLR uses a Just In time compiler to
compile the intermediate language code to the native
code of that device
The Common Language Runtime(CLR)
The Common Language Runtime(CLR)
method declaration
statement
statement
statement