SlideShare ist ein Scribd-Unternehmen logo
1 von 44
Course Title:-
VISUAL C#
Topic One:-
Introduction to C#
Course Instructor:-
Eng. Mohamed Idiris
1
.NET FRAMEWORK and C# History
 Microsoft started development on the .NET
Framework in the late 1990s originally under the
name of Next Generation Windows Services (NGWS).
 By late 2001 the first beta versions of .NET 1.0 were
released. The first version of .NET Framework was
released on 13 February 2002, bringing managed
code to Windows NT 4.0, 98, 2000, ME and XP.
2
Continued…
 During the development of the .NET Framework, the
class libraries were originally written using a
managed code compiler system called Simple
Managed C (SMC).
 In January 1999, Anders Hejlsberg formed a team to
build a new language at the time called Cool, which
stood for "C-like Object Oriented Language".
3
Continued…
 Microsoft had considered keeping the name "Cool" as
the final name of the language, but chose not to do
so for trademark reasons.
 By the time the .NET project was publicly announced
at the July 2000 Professional Developers Conference,
the language had been renamed C#, and the class
libraries and ASP.NET runtime had been ported to
C#.
4
Continued…
 Anders Hejlsberg is C#'s principal designer and lead
architect at Microsoft, and was previously involved
with the design of Turbo Pascal, Embarcadero Delphi
(formerly CodeGear Delphi, Inprise Delphi and
Borland Delphi), and Visual J++.
5
Continued…
 In interviews and technical papers he has stated that
flaws in most major programming languages (e.g.
C++, Java, Delphi, and Smalltalk) drove the
fundamentals of the Common Language Runtime
(CLR), which in turn, drove the design of the C#
language itself.
 Klaus Kreft and Angelika Langer (authors of a C++
streams book) stated in a blog post that "Java and
C# are almost identical programming languages. 6
C# VS JAVA
 James Gosling, who created the Java programming
language in 1994, and Bill Joy, a co-founder of Sun
Microsystems, the originator of Java, called C# an
"imitation" of Java; Gosling further said that "[C# is]
sort of Java with reliability, productivity and security
deleted.
7
Continued…
 Boring repetition that lacks innovation, hardly
anybody will claim that Java and/or C# are
revolutionary programming languages that changed
the way we write programs," and "C# borrowed a lot
from Java - and vice versa.
 Now that C# supports boxing and un-boxing, we'll
have a very similar feature in Java." In July 2000,
Hejlsberg said that C# is "not a Java clone" and is
"much closer to C++" in its design. 8
Finally
 Since the release of C# 2.0 in November 2005, the
C# and Java languages have evolved on increasingly
divergent trajectories, becoming somewhat less
similar.
 One of the first major departures came with the
addition of generics to both languages, with vastly
different implementations.
9
What Is .NET Framework?
 .NET Framework (pronounced as "dot net") is a
software development framework for building and
running applications on Windows.
 .NET Framework is developed by Microsoft.
 .NET Framework is part of the .NET platform, a
collection of technologies for building apps for Linux,
macOS, Windows, iOS, Android, and more.
10
Continued…
 The two major components of .NET Framework are
the Common Language Runtime and the .NET
Framework Class Library.
 It includes a large class library named Framework
Class Library (FCL) and provides language
interoperability (each language can use code written
in other languages) across several programming
languages.
11
Continued…
 Programs written for .NET Framework execute in
a software environment (in contrast to
a hardware environment) named Common
Language Runtime(CLR).
 FCL and CLR together constitute the .NET
Framework.
12
Continued…
 FCL provides the user interface, data
access, database connectivity, cryptography, web
application development, numeric algorithms,
and network communications.
 Programmers produce software by combining
their source code with .NET Framework and other
libraries.
13
Continued…
 The framework is intended to be used by most new
applications created for the Windows platform.
 Microsoft also produces an Integrated Development
Environment (IDE) for .NET software called Visual
Studio.
14
Common Language Runtime
 The Common Language Runtime (CLR),
the virtual machine component of Microsoft's .NET
framework, manages the execution of .NET
programs.
 A process known as just-in-time compilation converts
compiled code into machine instructions which the
computer's CPU then executes
15
Continued…
 To support hardware and operating-system
independence, Microsoft developed the Microsoft
Intermediate Language (MSIL, or just IL).
 IL is a CPU-independent machine language-style
instruction set into which .NET Framework programs
are compiled.
16
Continued…
 IL programs are compiled to the actual machine
language on the target platform prior to execution
(known as just-in-time, or JIT, compiling). IL is never
interpreted.
17
Continued…
18
What is C#?
 C# is a modern, general-purpose, object-oriented
programming language developed by Microsoft that
runs on the .NET Framework and approved by
European Computer Manufacturers Association
(ECMA) and International Standards
Organization (ISO).
 C# was developed by Anders Hejlsberg and his team
during the development of .NET Framework.
19
Continued…
 C# is used to develop web applications, desktop
applications, mobile applications, database
applications, games and much more.
 C# has roots from the C family, and the language is
close to other popular languages like C++ and Java.
 The first version was released in year 2002. The latest
version, C# 10.0, was released in November 2021.
20
Continued…
 C# is designed for Common Language Infrastructure
(CLI), which consists of the executable code and
runtime environment that allows use of various high-
level languages on different computer platforms and
architectures.
21
Reasons to Use C#
The following reasons make C# a widely used
professional language:
 It is a modern, general-purpose programming
language
 It is object oriented.
 It is easy to learn.
 It is a structured language.
 It produces efficient programs.
 It is a part of .NET Framework. 22
Can C# run on multiple platforms?
 C# can be compiled for and run on multiple platforms
(Windows, Linux, macOS) by using . NET Core.
Previously, cross-platform development using C#
could only be done by using Mono which is a third-
party implementation however it is now
recommended to use . NET Core as it is developed by
Microsoft.
23
What Is a Program Made Of?
 All programming languages, including C#, have
certain elements in common. Let’s look at the major
programming language elements that you will work
with when writing a program.
24
Keywords (Reserved Words)
 Each high-level language has its own set of words
that the programmer must learn in order to use the
language.
 The words that make up a high-level programming
language are known as keywords or reserved
words.
Each keyword has a specific meaning and cannot be
used for any other purpose.
25
Operators
In addition to keywords, programming languages have
operators that perform various operations on data.
For example, all programming languages have math
operators that perform arithmetic. C#, as well as
most other languages, the sign is an operator that
adds two numbers. The following would add 12 and
75:
C#: 12+75;
26
Variables
 Programs use variables to store data in memory.
 A variable is a storage location in memory that is
represented by a name. When a value is stored in a
variable, it is stored in the computer’s memory.
27
Syntax
 In addition to keywords and operators, each
language also has its own syntax, which is a set of
rules that must be strictly followed when writing a
program. The syntax rules dictate how keywords,
operators, and various punctuation characters must
be used in a program.
28
Statements
 The individual instructions that you write in a
program are called Statements. A programming
statement can consist of keywords, operators,
punctuation, and other allowable programming
elements, arranged in the proper sequence to
perform an operation.
 The statements that are written in a program are
commonly called source code, or simply code.
29
Procedures
 A procedure is a set of programming statements
that exist within a program for the purpose of
performing a specific task. The program executes the
procedure when the task needs to be performed.
30
The Programming Process
The programming process consists of several steps,
which include designing, creating, testing, and
debugging activities.
31
PROGRAM STRUCTURE
 Before we study basic building blocks of the C#
programming language, let us look a bare minimum
C# program structure so that we can take it as a
reference in upcoming chapters
32
C# Hello World Example
A program basically consists of the following parts:
 Namespace declaration
 A class
 One or more procedures
 Variables
 Statements & Expressions
 Comments
33
Primitive Types
 You can define variables in your programs whose
type is one of the primitive types.
 Variables can hold values that you can read,
manipulate, and write. There are different types of
variables, and the type specifies what kind of data
the variable can have.
34
Primitive Types (by Table)
35
Expressions
 When performing computations in your code, you’ll
do so through expressions, which are a combination
of variables, operators (such as addition or
multiplication), or referencing other class members.
36
Arithmetic operators in C#
37
Assume variable A holds 10 and variable B holds 20 then −
Comparison Operators in C#
38
Consider x is a variable and the value assigned the x=2 then,
Logical Operators in C#
39
Assume variable A holds Boolean value true and variable B holds Boolean value false, then −
C# - Type Conversion
 Type conversion is converting one type of data to
another type. It is also known as Type Casting. In
C#, type casting has two forms −
40
C# - Type Conversion(Continued…)
 Implicit type conversion − These conversions are
performed by C# in a type-safe manner. For example,
are conversions from smaller to larger integral types.
 Explicit type conversion − These conversions are
done explicitly by users using the pre-defined
functions. Explicit conversions require a cast
operator.
41
42
Continued…
43
THANKS…
44

Weitere ähnliche Inhalte

Ähnlich wie Chapter-1 C#.pptx

Design patterns in_c_sharp
Design patterns in_c_sharpDesign patterns in_c_sharp
Design patterns in_c_sharpCao Tuan
 
Event Driven Programming in C#.docx
Event Driven Programming in C#.docxEvent Driven Programming in C#.docx
Event Driven Programming in C#.docxLenchoMamudeBaro
 
.Net framework
.Net framework.Net framework
.Net frameworkRaghu nath
 
IP Lab Manual for Kerala University 3 Year UG Programme
IP Lab Manual for Kerala University 3 Year UG ProgrammeIP Lab Manual for Kerala University 3 Year UG Programme
IP Lab Manual for Kerala University 3 Year UG ProgrammeSAFAD ISMAIL
 
Advance C# Programming Part 1.pptx
Advance C# Programming Part 1.pptxAdvance C# Programming Part 1.pptx
Advance C# Programming Part 1.pptxpercivalfernandez3
 
Introduction to Computer Programming (general background)
Introduction to Computer Programming (general background)Introduction to Computer Programming (general background)
Introduction to Computer Programming (general background)Chao-Lung Yang
 
all languages in computer programming
all languages in computer programmingall languages in computer programming
all languages in computer programminghamza239523
 
Summer training PPT Manasv Singharia.pptx
Summer training PPT Manasv Singharia.pptxSummer training PPT Manasv Singharia.pptx
Summer training PPT Manasv Singharia.pptxshokeenk14
 
Advance C# Programming Part 1.pdf
Advance C# Programming Part 1.pdfAdvance C# Programming Part 1.pdf
Advance C# Programming Part 1.pdfpercivalfernandez2
 
Java Is A Programming Dialect And Registering Stage Essay
Java Is A Programming Dialect And Registering Stage EssayJava Is A Programming Dialect And Registering Stage Essay
Java Is A Programming Dialect And Registering Stage EssayLiz Sims
 
c# usage,applications and advantages
c# usage,applications and advantages c# usage,applications and advantages
c# usage,applications and advantages mohamed drahem
 

Ähnlich wie Chapter-1 C#.pptx (20)

Programming with c#
Programming with c#Programming with c#
Programming with c#
 
Programming in c#
Programming in c#Programming in c#
Programming in c#
 
Design patterns in_c_sharp
Design patterns in_c_sharpDesign patterns in_c_sharp
Design patterns in_c_sharp
 
C# handout.docx
C# handout.docxC# handout.docx
C# handout.docx
 
Event Driven Programming in C#.docx
Event Driven Programming in C#.docxEvent Driven Programming in C#.docx
Event Driven Programming in C#.docx
 
C#.ppt
C#.pptC#.ppt
C#.ppt
 
.Net framework
.Net framework.Net framework
.Net framework
 
IP Lab Manual for Kerala University 3 Year UG Programme
IP Lab Manual for Kerala University 3 Year UG ProgrammeIP Lab Manual for Kerala University 3 Year UG Programme
IP Lab Manual for Kerala University 3 Year UG Programme
 
What is C.docx
What is C.docxWhat is C.docx
What is C.docx
 
Intro1
Intro1Intro1
Intro1
 
Advance C# Programming Part 1.pptx
Advance C# Programming Part 1.pptxAdvance C# Programming Part 1.pptx
Advance C# Programming Part 1.pptx
 
CS3251-_PIC
CS3251-_PICCS3251-_PIC
CS3251-_PIC
 
Introduction to Computer Programming (general background)
Introduction to Computer Programming (general background)Introduction to Computer Programming (general background)
Introduction to Computer Programming (general background)
 
all languages in computer programming
all languages in computer programmingall languages in computer programming
all languages in computer programming
 
Summer training PPT Manasv Singharia.pptx
Summer training PPT Manasv Singharia.pptxSummer training PPT Manasv Singharia.pptx
Summer training PPT Manasv Singharia.pptx
 
Advance C# Programming Part 1.pdf
Advance C# Programming Part 1.pdfAdvance C# Programming Part 1.pdf
Advance C# Programming Part 1.pdf
 
Unit 2 l1
Unit 2 l1Unit 2 l1
Unit 2 l1
 
Java Is A Programming Dialect And Registering Stage Essay
Java Is A Programming Dialect And Registering Stage EssayJava Is A Programming Dialect And Registering Stage Essay
Java Is A Programming Dialect And Registering Stage Essay
 
Introduction to c language
Introduction to c language Introduction to c language
Introduction to c language
 
c# usage,applications and advantages
c# usage,applications and advantages c# usage,applications and advantages
c# usage,applications and advantages
 

Kürzlich hochgeladen

ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxcallscotland1987
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseAnaAcapella
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 

Kürzlich hochgeladen (20)

ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 

Chapter-1 C#.pptx

  • 1. Course Title:- VISUAL C# Topic One:- Introduction to C# Course Instructor:- Eng. Mohamed Idiris 1
  • 2. .NET FRAMEWORK and C# History  Microsoft started development on the .NET Framework in the late 1990s originally under the name of Next Generation Windows Services (NGWS).  By late 2001 the first beta versions of .NET 1.0 were released. The first version of .NET Framework was released on 13 February 2002, bringing managed code to Windows NT 4.0, 98, 2000, ME and XP. 2
  • 3. Continued…  During the development of the .NET Framework, the class libraries were originally written using a managed code compiler system called Simple Managed C (SMC).  In January 1999, Anders Hejlsberg formed a team to build a new language at the time called Cool, which stood for "C-like Object Oriented Language". 3
  • 4. Continued…  Microsoft had considered keeping the name "Cool" as the final name of the language, but chose not to do so for trademark reasons.  By the time the .NET project was publicly announced at the July 2000 Professional Developers Conference, the language had been renamed C#, and the class libraries and ASP.NET runtime had been ported to C#. 4
  • 5. Continued…  Anders Hejlsberg is C#'s principal designer and lead architect at Microsoft, and was previously involved with the design of Turbo Pascal, Embarcadero Delphi (formerly CodeGear Delphi, Inprise Delphi and Borland Delphi), and Visual J++. 5
  • 6. Continued…  In interviews and technical papers he has stated that flaws in most major programming languages (e.g. C++, Java, Delphi, and Smalltalk) drove the fundamentals of the Common Language Runtime (CLR), which in turn, drove the design of the C# language itself.  Klaus Kreft and Angelika Langer (authors of a C++ streams book) stated in a blog post that "Java and C# are almost identical programming languages. 6
  • 7. C# VS JAVA  James Gosling, who created the Java programming language in 1994, and Bill Joy, a co-founder of Sun Microsystems, the originator of Java, called C# an "imitation" of Java; Gosling further said that "[C# is] sort of Java with reliability, productivity and security deleted. 7
  • 8. Continued…  Boring repetition that lacks innovation, hardly anybody will claim that Java and/or C# are revolutionary programming languages that changed the way we write programs," and "C# borrowed a lot from Java - and vice versa.  Now that C# supports boxing and un-boxing, we'll have a very similar feature in Java." In July 2000, Hejlsberg said that C# is "not a Java clone" and is "much closer to C++" in its design. 8
  • 9. Finally  Since the release of C# 2.0 in November 2005, the C# and Java languages have evolved on increasingly divergent trajectories, becoming somewhat less similar.  One of the first major departures came with the addition of generics to both languages, with vastly different implementations. 9
  • 10. What Is .NET Framework?  .NET Framework (pronounced as "dot net") is a software development framework for building and running applications on Windows.  .NET Framework is developed by Microsoft.  .NET Framework is part of the .NET platform, a collection of technologies for building apps for Linux, macOS, Windows, iOS, Android, and more. 10
  • 11. Continued…  The two major components of .NET Framework are the Common Language Runtime and the .NET Framework Class Library.  It includes a large class library named Framework Class Library (FCL) and provides language interoperability (each language can use code written in other languages) across several programming languages. 11
  • 12. Continued…  Programs written for .NET Framework execute in a software environment (in contrast to a hardware environment) named Common Language Runtime(CLR).  FCL and CLR together constitute the .NET Framework. 12
  • 13. Continued…  FCL provides the user interface, data access, database connectivity, cryptography, web application development, numeric algorithms, and network communications.  Programmers produce software by combining their source code with .NET Framework and other libraries. 13
  • 14. Continued…  The framework is intended to be used by most new applications created for the Windows platform.  Microsoft also produces an Integrated Development Environment (IDE) for .NET software called Visual Studio. 14
  • 15. Common Language Runtime  The Common Language Runtime (CLR), the virtual machine component of Microsoft's .NET framework, manages the execution of .NET programs.  A process known as just-in-time compilation converts compiled code into machine instructions which the computer's CPU then executes 15
  • 16. Continued…  To support hardware and operating-system independence, Microsoft developed the Microsoft Intermediate Language (MSIL, or just IL).  IL is a CPU-independent machine language-style instruction set into which .NET Framework programs are compiled. 16
  • 17. Continued…  IL programs are compiled to the actual machine language on the target platform prior to execution (known as just-in-time, or JIT, compiling). IL is never interpreted. 17
  • 19. What is C#?  C# is a modern, general-purpose, object-oriented programming language developed by Microsoft that runs on the .NET Framework and approved by European Computer Manufacturers Association (ECMA) and International Standards Organization (ISO).  C# was developed by Anders Hejlsberg and his team during the development of .NET Framework. 19
  • 20. Continued…  C# is used to develop web applications, desktop applications, mobile applications, database applications, games and much more.  C# has roots from the C family, and the language is close to other popular languages like C++ and Java.  The first version was released in year 2002. The latest version, C# 10.0, was released in November 2021. 20
  • 21. Continued…  C# is designed for Common Language Infrastructure (CLI), which consists of the executable code and runtime environment that allows use of various high- level languages on different computer platforms and architectures. 21
  • 22. Reasons to Use C# The following reasons make C# a widely used professional language:  It is a modern, general-purpose programming language  It is object oriented.  It is easy to learn.  It is a structured language.  It produces efficient programs.  It is a part of .NET Framework. 22
  • 23. Can C# run on multiple platforms?  C# can be compiled for and run on multiple platforms (Windows, Linux, macOS) by using . NET Core. Previously, cross-platform development using C# could only be done by using Mono which is a third- party implementation however it is now recommended to use . NET Core as it is developed by Microsoft. 23
  • 24. What Is a Program Made Of?  All programming languages, including C#, have certain elements in common. Let’s look at the major programming language elements that you will work with when writing a program. 24
  • 25. Keywords (Reserved Words)  Each high-level language has its own set of words that the programmer must learn in order to use the language.  The words that make up a high-level programming language are known as keywords or reserved words. Each keyword has a specific meaning and cannot be used for any other purpose. 25
  • 26. Operators In addition to keywords, programming languages have operators that perform various operations on data. For example, all programming languages have math operators that perform arithmetic. C#, as well as most other languages, the sign is an operator that adds two numbers. The following would add 12 and 75: C#: 12+75; 26
  • 27. Variables  Programs use variables to store data in memory.  A variable is a storage location in memory that is represented by a name. When a value is stored in a variable, it is stored in the computer’s memory. 27
  • 28. Syntax  In addition to keywords and operators, each language also has its own syntax, which is a set of rules that must be strictly followed when writing a program. The syntax rules dictate how keywords, operators, and various punctuation characters must be used in a program. 28
  • 29. Statements  The individual instructions that you write in a program are called Statements. A programming statement can consist of keywords, operators, punctuation, and other allowable programming elements, arranged in the proper sequence to perform an operation.  The statements that are written in a program are commonly called source code, or simply code. 29
  • 30. Procedures  A procedure is a set of programming statements that exist within a program for the purpose of performing a specific task. The program executes the procedure when the task needs to be performed. 30
  • 31. The Programming Process The programming process consists of several steps, which include designing, creating, testing, and debugging activities. 31
  • 32. PROGRAM STRUCTURE  Before we study basic building blocks of the C# programming language, let us look a bare minimum C# program structure so that we can take it as a reference in upcoming chapters 32
  • 33. C# Hello World Example A program basically consists of the following parts:  Namespace declaration  A class  One or more procedures  Variables  Statements & Expressions  Comments 33
  • 34. Primitive Types  You can define variables in your programs whose type is one of the primitive types.  Variables can hold values that you can read, manipulate, and write. There are different types of variables, and the type specifies what kind of data the variable can have. 34
  • 35. Primitive Types (by Table) 35
  • 36. Expressions  When performing computations in your code, you’ll do so through expressions, which are a combination of variables, operators (such as addition or multiplication), or referencing other class members. 36
  • 37. Arithmetic operators in C# 37 Assume variable A holds 10 and variable B holds 20 then −
  • 38. Comparison Operators in C# 38 Consider x is a variable and the value assigned the x=2 then,
  • 39. Logical Operators in C# 39 Assume variable A holds Boolean value true and variable B holds Boolean value false, then −
  • 40. C# - Type Conversion  Type conversion is converting one type of data to another type. It is also known as Type Casting. In C#, type casting has two forms − 40
  • 41. C# - Type Conversion(Continued…)  Implicit type conversion − These conversions are performed by C# in a type-safe manner. For example, are conversions from smaller to larger integral types.  Explicit type conversion − These conversions are done explicitly by users using the pre-defined functions. Explicit conversions require a cast operator. 41
  • 42. 42