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
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
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