SlideShare a Scribd company logo
Introduction to programming using C#
Eng. Reham M. El-Safarini
•Outline:
2
 History.
 About C# Language.
 .NET Framework Platform Architecture.
 C# built-In types.
 Namespace & Nested Namespace.
 Object Oriented.
 Visual Studio installation.
 Hello world – First application.
 Lab work.
•History
 In concurrence with the success of java programming language, the
idea of new programming language starts to be under construction
and it’s called C#. C# is simple managed C (SMC) compiler system
unlike the C/C++ unmanaged language.
 C# means musical note such as C/C++.
 C# is an object oriented programming language which means it’s
class based and developer can apply relations such as Inheritance ,
Encapsulation and Polymorphism.
 It was released in 2000 and the project called .NET framework
3
•About C# Language
4
C# syntax is highly expressive, yet it is also simple and easy to
learn. The curly-brace syntax of C# will be instantly recognizable
to anyone familiar with C, C++ or Java. Developers who know
any of these languages are typically able to begin to work
productively in C# within a very short time. C# syntax simplifies
many of the complexities of C++ and provides powerful features
such as nullable value types, enumerations, delegates, lambda
expressions and direct memory access, which are not found in
Java. C# supports generic methods and types, which provide
increased type safety and performance, and iterators, which
enable implementers of collection classes to define custom
iteration behaviors that are simple to use by client code.
•About C# Language-Cont.
5
Language-Integrated Query (LINQ) expressions make the
strongly-typed query a first-class language construct.
As an object-oriented language, C# supports the concepts of
encapsulation, inheritance, and polymorphism. All variables and
methods, including the Main method, the application's entry
point, are encapsulated within class definitions. A class may
inherit directly from one parent class, but it may implement any
number of interfaces. Methods that override virtual methods in a
parent class require the override keyword as a way to avoid
accidental redefinition. In C#, a struct is like a lightweight class;
it is a stack-allocated type that can implement interfaces but does
not support inheritance.
In addition to these basic object-oriented principles, C# makes it
easy to develop software components through several innovative
language constructs, including the following:
•About C# Language-Cont.
6
Language-Integrated Query (LINQ) which provides built-in
query capabilities across a variety of data sources.
If you have to interact with other Windows software such as
COM objects or native Win32 DLLs, you can do this in C#
through a process called "Interop." Interop enables C#
programs to do almost anything that a native C++
application can do. C# even supports pointers and the
concept of "unsafe" code for those cases in which direct
memory access is absolutely critical.
The C# build process is simple compared to C and C++ and
more flexible than in Java. There are no separate header
files, and no requirement that methods and types be declared
in a particular order. A C# source file may define any
number of classes, structs, interfaces, and events.
•.NET Framework Platform Architecture
7
The idea behind .NET Framework is to
make a platform that can accept many languages
and then compiler will handle it.
C# programs run on the .NET Framework,
an integral component of Windows that includes
a virtual execution system called the common language
runtime (CLR) and a unified set of class libraries.
The CLR is the commercial implementation by Microsoft
of the common language infrastructure (CLI),
an international standard that is the basis for
creating execution and development environments in which
languages and libraries work together seamlessly.
Source code written in C# is compiled into an intermediate
language (IL) that conforms to the CLI specification.
The IL code and resources, such as bitmaps and strings, are stored on disk in an executable file called an
assembly, typically with an extension of .exe or .dll. An assembly contains a manifest that provides
information about the assembly's types, version, culture, and security requirements.
•.NET Framework Platform Architecture-Cont
8
When the C# program is executed, the assembly is loaded into
the CLR, which might take various actions based on the
information in the manifest. Then, if the security requirements are
met, the CLR performs just in time (JIT) compilation to convert
the IL code to native machine instructions. The CLR also
provides other services related to automatic garbage collection,
exception handling, and resource management. Code that is
executed by the CLR is sometimes referred to as "managed
code," in contrast to "unmanaged code" which is compiled into
native machine language that targets a specific system. The
following diagram illustrates the compile-time and run-time
relationships of C# source code files, the .NET Framework class
libraries, assemblies, and the CLR.
•.NET Framework Platform Architecture-Cont
9
•C# built-In types:
10
In order to define variables, developer needs to decide which
type to choose for example if you want to define a number you
need to declare a variable using int, for example:
int number = 0;
And so on.
Type variable Assig
n
Initial value
semicolon
Left hand-side Right hand-
side
•C# built-In types – Cont.:
11
It is used to declare variables to store the Boolean values, true and false.
The byte keyword denotes an integral type that stores values that ranges between 0-255, allocate size
Unsigned 8-bit integer
The char keyword is used to declare an instance of the System.Char structure that the .NET Framework
uses to represent a Unicode character. The value of a Char object is a 16-bit numeric (ordinal) value.
The byte keyword denotes an integral type that stores values that ranges between -128 to 127, allocate
size signed 8-bit integer
The decimal keyword indicates a 128-bit data type. Compared to floating-point types, the decimal type has more
precision and a smaller range, which makes it appropriate for financial and monetary calculations. The approximate
range is (-7.9 x 1028 to 7.9 x 1028) / (100 to 28) and precision for the decimal type is 28-29 significant digits
The double keyword signifies a simple type that stores 64-bit floating-point values. The precision is ±5.0 × 10−324 to
±1.7 × 10308 and approximate range for the double type is 15-16 digits.
The float keyword signifies a simple type that stores 32-bit floating-point values. The precision is 7 digits and
approximate range for the float type is -3.4 × 1038to +3.4 × 1038.
The int keyword denotes an integral type that stores values within Signed 32-bit integer size and within -
2,147,483,648 to 2,147,483,647 range
The uint keyword signifies an integral type that stores values within Unsigned 32-bit integer size and within 0 to
4,294,967,295 range
The long keyword denotes an integral type that stores values within Signed 64-bit integer size and within
9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 range
The ulong keyword denotes an integral type that stores values within Unsigned 64-bit integer size and within 0 to
18,446,744,073,709,551,615
The object type is an alias for Object in the .NET Framework. In the unified type system of C#, all types, predefined and
user-defined, reference types and value types, inherit directly or indirectly from Object. You can assign values of any
type to variables of type object
The short keyword denotes an integral data type that stores values within -32,768 to 32,767 size and within
Signed 16-bit integer range .
The ushort keyword indicates an integral data type that stores values within Unsigned 16-bit integer size
and within 0 to 65,535 range .
The string type represents a sequence of zero or more Unicode characters. string is an alias for String in
the .NET Framework.
•Namespace:
12
Namespaces are used to provide a "named space" in which your application resides. They're used especially to
provide the C# compiler a context for all the named information in your program, such as variable names. Without
namespaces, for example, you wouldn't be able to make a class named Console, as .NET already uses one in its
System namespace. The purpose of namespaces is to solve this problem, and release thousands of names defined in
the .NET Framework for your applications to use, along with making it so your application doesn't occupy names
for other applications, if your application is intended to be used in conjunction with another. So namespaces exist to
resolve ambiguities a compiler wouldn't otherwise be able to do.
•Nested Namespace:
13
Normally, your entire application resides under its own special namespace,
often named after your application or project name. Sometimes, companies
with an entire product series decide to use nested namespaces though, where
the "root" namespace can share the name of the company, and the nested
namespaces the respective project names. This can be especially convenient,
if you're a developer who has made a library with some usual functionality
that can be shared across programs. If both the library and your program
shared a parent namespace, that one would then not have to be explicitly
declared with the using keyword, and still not have to be completely typed
out. If your code was open for others to use, third party developers that may
use your code would additionally then see that the same company had
developed the library and the program. The developer of the library and
program would finally also separate all the named information in their
product source codes, for fewer headaches especially, if common names are
used.
•Object Oriented:
14
Object Oriented is a very important concept that every developer to be needs to
know. The simple type int lets you declare integer variables as shown previously in
slide 10 , and in the same way, you can create your own classes, which contain not
only data like the simple types, but methods as well. Just as you create integer
variables with the int type, so you create objects from classes. An integer variable
is an instance of the int type, just like an object is an instance of a class. Classes are
types, but are far more powerful than the simple types like int and float. Not only
can you customize your data storage using classes, but you can also add methods to
classes. That kind of compartmentalization—where data and methods are rolled up
into a single class—is the entire reason that OOP was introduced in the first place.
It enables the programmers to deal with larger programs. The process of wrapping
related data and methods into a class (and so preventing them from cluttering up
the rest of the program) to create a single entity is called encapsulation.
•Object Oriented-Cont.:
15
You create classes in C# with the class statement:
[attributes] [modifiers] class identifier [:base-list] { class-body }[;]
Here are the parts of this statement:
 attributes (Optional)—Attributes hold additional declarative information.
modifiers (Optional)—The allowed modifiers are new, static, virtual, abstract,
override, and a valid combination of the four access modifiers.
identifier—The class name. n base-list (Optional)—A list that contains the base class
and any implemented interfaces, separated by commas.
 class-body—Declarations of the class members.
•Object Oriented-Cont.:
16
Creating Objects To create an object, also called an instance, of a class,
you use the new keyword. We’ve seen how this process works; you can
see how we create a new object of the Calculator in exercise at last
slide, AddItem method to add numbers. Note the parentheses after
Calculator -highlighted with blue- in the statement
Calculator obj = new Calculator();.
These parentheses are necessary when you use the new keyword. They
let you pass data to a class’s constructor, the special method that lets
you initialize the data in a class.
•Visual Studio installation
17
Definition :
Visual studio is a Microsoft IDE(Integrated Development Environment) where a developer can install and
use to create programs.
To install VS you need to visit visualstudio and then select one of these products as shown in figure
below
•Visual Studio installation – Cont.
18
Once you click on the link, the execution file will automatically be downloaded. As
shown in figure below,
•Visual Studio installation – Cont.
19
A wizard will launch , press continue
A waiting dialogue will start
•Visual Studio installation – Cont.
20
Check the boxes and then press install
•Visual Studio installation – Cont.
21
The installer will start acquiring to finally install the VS.
•Visual Studio installation – Cont.
22
Now the installer has finished , press launch.
•Visual Studio installation – Cont.
23
Sign in with your account, and if you don’t have one sign up for one, or you can
press Not now , maybe later. Choose your color and then press start visual studio
•Hello world
24
After successfully installing Visual studio now it’s time to create your first
application. Select File -> New -> Project as shown in figure below,
•Hello world – Cont.
25
Now select console application, and then type “Hello World” application. Then press Ok
•Hello world – Cont.
26
Inside the main class type Console.WriteLine("Hello World"); .
Press Ctrl+F5
•Hello world – Cont.
27
Output:
•Lab work:
28
 Description:
1.Launch VS, and then create new project.
2.The project will be building a calculator that will add,
subtract, divide and multiply numbers.
3.Apply Object oriented to the project.
Challenge : try to create windows form application.
Note: I will provide the solution next week.
•References:
 https://classes.soe.ucsc.edu/cmps020/Winter08/lectures
/intro-csharp.pdf
 https://msdn.microsoft.com/en-us/library/z1zx9t92.aspx
 https://msdn.microsoft.com/en-us/library/ya5y69ds.aspx
 https://en.wikibooks.org/wiki/C_Sharp_Programming/Na
mespaces
 http://catalogue.pearsoned.co.uk/samplechapter/067232
5470.pdf
29

More Related Content

What's hot

C# lecture 2: Literals , Variables and Data Types in C#
C# lecture 2: Literals , Variables and Data Types in C#C# lecture 2: Literals , Variables and Data Types in C#
C# lecture 2: Literals , Variables and Data Types in C#
Dr.Neeraj Kumar Pandey
 
Promoting Polymorphism
Promoting PolymorphismPromoting Polymorphism
Promoting Polymorphism
Kevlin Henney
 
C Course Material0209
C Course Material0209C Course Material0209
C Course Material0209
chameli devi group of institutions
 
C sharp
C sharpC sharp
C sharp
sanjay joshi
 
C# - Part 1
C# - Part 1C# - Part 1
C# - Part 1
Md. Mahedee Hasan
 
Namespaces in C#
Namespaces in C#Namespaces in C#
Namespaces in C#
yogita kachve
 
Introduction to c++ ppt 1
Introduction to c++ ppt 1Introduction to c++ ppt 1
Introduction to c++ ppt 1
Prof. Dr. K. Adisesha
 
Dot net-interview-questions-and-answers part i
Dot net-interview-questions-and-answers part iDot net-interview-questions-and-answers part i
Dot net-interview-questions-and-answers part i
Rakesh Joshi
 
Dot net-interview-questions-and-answers part i
Dot net-interview-questions-and-answers part iDot net-interview-questions-and-answers part i
Dot net-interview-questions-and-answers part i
Rakesh Joshi
 
Object oriented-programming-in-c-sharp
Object oriented-programming-in-c-sharpObject oriented-programming-in-c-sharp
Object oriented-programming-in-c-sharp
Abefo
 
C# programming language
C# programming languageC# programming language
C# programming language
swarnapatil
 
Design patterns in_c_sharp
Design patterns in_c_sharpDesign patterns in_c_sharp
Design patterns in_c_sharp
Cao Tuan
 
Introduction of c programming unit-ii ppt
Introduction of  c programming unit-ii pptIntroduction of  c programming unit-ii ppt
Introduction of c programming unit-ii ppt
JStalinAsstProfessor
 
Overview of c#
Overview of c#Overview of c#
Overview of c#
Prasanna Kumar SM
 
Unit 1 question and answer
Unit 1 question and answerUnit 1 question and answer
Unit 1 question and answer
Vasuki Ramasamy
 
Csharp4 basics
Csharp4 basicsCsharp4 basics
Csharp4 basics
Abed Bukhari
 
Object oriented concepts ppt
Object oriented concepts pptObject oriented concepts ppt
Object oriented concepts ppt
Prof. Dr. K. Adisesha
 
Dot net
Dot netDot net
Dot net
public
 
Tutorial c#
Tutorial c#Tutorial c#
Tutorial c#
Mohammad Faizan
 
Lecture 1 progrmming with C
Lecture 1 progrmming with C Lecture 1 progrmming with C
Lecture 1 progrmming with C
Army Public School and College -Faisal
 

What's hot (20)

C# lecture 2: Literals , Variables and Data Types in C#
C# lecture 2: Literals , Variables and Data Types in C#C# lecture 2: Literals , Variables and Data Types in C#
C# lecture 2: Literals , Variables and Data Types in C#
 
Promoting Polymorphism
Promoting PolymorphismPromoting Polymorphism
Promoting Polymorphism
 
C Course Material0209
C Course Material0209C Course Material0209
C Course Material0209
 
C sharp
C sharpC sharp
C sharp
 
C# - Part 1
C# - Part 1C# - Part 1
C# - Part 1
 
Namespaces in C#
Namespaces in C#Namespaces in C#
Namespaces in C#
 
Introduction to c++ ppt 1
Introduction to c++ ppt 1Introduction to c++ ppt 1
Introduction to c++ ppt 1
 
Dot net-interview-questions-and-answers part i
Dot net-interview-questions-and-answers part iDot net-interview-questions-and-answers part i
Dot net-interview-questions-and-answers part i
 
Dot net-interview-questions-and-answers part i
Dot net-interview-questions-and-answers part iDot net-interview-questions-and-answers part i
Dot net-interview-questions-and-answers part i
 
Object oriented-programming-in-c-sharp
Object oriented-programming-in-c-sharpObject oriented-programming-in-c-sharp
Object oriented-programming-in-c-sharp
 
C# programming language
C# programming languageC# programming language
C# programming language
 
Design patterns in_c_sharp
Design patterns in_c_sharpDesign patterns in_c_sharp
Design patterns in_c_sharp
 
Introduction of c programming unit-ii ppt
Introduction of  c programming unit-ii pptIntroduction of  c programming unit-ii ppt
Introduction of c programming unit-ii ppt
 
Overview of c#
Overview of c#Overview of c#
Overview of c#
 
Unit 1 question and answer
Unit 1 question and answerUnit 1 question and answer
Unit 1 question and answer
 
Csharp4 basics
Csharp4 basicsCsharp4 basics
Csharp4 basics
 
Object oriented concepts ppt
Object oriented concepts pptObject oriented concepts ppt
Object oriented concepts ppt
 
Dot net
Dot netDot net
Dot net
 
Tutorial c#
Tutorial c#Tutorial c#
Tutorial c#
 
Lecture 1 progrmming with C
Lecture 1 progrmming with C Lecture 1 progrmming with C
Lecture 1 progrmming with C
 

Similar to Introduction to programming using c

C-sharping.docx
C-sharping.docxC-sharping.docx
C-sharping.docx
LenchoMamudeBaro
 
A tour of C# - Overview _ Microsoft Learn.pdf
A tour of C# - Overview _ Microsoft Learn.pdfA tour of C# - Overview _ Microsoft Learn.pdf
A tour of C# - Overview _ Microsoft Learn.pdf
ParasJain570452
 
Dotnet interview qa
Dotnet interview qaDotnet interview qa
Dotnet interview qa
abcxyzqaz
 
Summer training PPT Manasv Singharia.pptx
Summer training PPT Manasv Singharia.pptxSummer training PPT Manasv Singharia.pptx
Summer training PPT Manasv Singharia.pptx
shokeenk14
 
Event Driven Programming in C#.docx
Event Driven Programming in C#.docxEvent Driven Programming in C#.docx
Event Driven Programming in C#.docx
LenchoMamudeBaro
 
Top 50 .NET Interview Questions and Answers 2019 | Edureka
Top 50 .NET Interview Questions and Answers 2019 | EdurekaTop 50 .NET Interview Questions and Answers 2019 | Edureka
Top 50 .NET Interview Questions and Answers 2019 | Edureka
Edureka!
 
.Net framework
.Net framework.Net framework
.Net framework
Raghu nath
 
Part 1
Part 1Part 1
2. C# Guide - To Print
2. C# Guide - To Print2. C# Guide - To Print
2. C# Guide - To Print
Chinthaka Fernando
 
CLR_via_CSharp_(Jeffrey_Richter_4th_Edition).pdf
CLR_via_CSharp_(Jeffrey_Richter_4th_Edition).pdfCLR_via_CSharp_(Jeffrey_Richter_4th_Edition).pdf
CLR_via_CSharp_(Jeffrey_Richter_4th_Edition).pdf
ssuserbe139c
 
1 puc programming using c++
1 puc programming using c++1 puc programming using c++
1 puc programming using c++
Prof. Dr. K. Adisesha
 
Oops index
Oops indexOops index
Oops index
Hitesh Wagle
 
New microsoft office word document
New microsoft office word documentNew microsoft office word document
New microsoft office word document
SIVAJISADHANA
 
New microsoft office word document
New microsoft office word documentNew microsoft office word document
New microsoft office word document
SIVAJISADHANA
 
New microsoft office word document
New microsoft office word documentNew microsoft office word document
New microsoft office word document
SIVAJISADHANA
 
Chapter1
Chapter1Chapter1
Chapter1
guest9ccd0e
 
C# Unit 1 notes
C# Unit 1 notesC# Unit 1 notes
C# Unit 1 notes
Sudarshan Dhondaley
 
21UCAC61 C# and .Net Programming.pdf(MTNC)(BCA)
21UCAC61 C# and .Net Programming.pdf(MTNC)(BCA)21UCAC61 C# and .Net Programming.pdf(MTNC)(BCA)
21UCAC61 C# and .Net Programming.pdf(MTNC)(BCA)
ssuser7f90ae
 
Bcsl 031 solve assignment
Bcsl 031 solve assignmentBcsl 031 solve assignment
Session2 (3)
Session2 (3)Session2 (3)
Session2 (3)
DrUjwala1
 

Similar to Introduction to programming using c (20)

C-sharping.docx
C-sharping.docxC-sharping.docx
C-sharping.docx
 
A tour of C# - Overview _ Microsoft Learn.pdf
A tour of C# - Overview _ Microsoft Learn.pdfA tour of C# - Overview _ Microsoft Learn.pdf
A tour of C# - Overview _ Microsoft Learn.pdf
 
Dotnet interview qa
Dotnet interview qaDotnet interview qa
Dotnet interview qa
 
Summer training PPT Manasv Singharia.pptx
Summer training PPT Manasv Singharia.pptxSummer training PPT Manasv Singharia.pptx
Summer training PPT Manasv Singharia.pptx
 
Event Driven Programming in C#.docx
Event Driven Programming in C#.docxEvent Driven Programming in C#.docx
Event Driven Programming in C#.docx
 
Top 50 .NET Interview Questions and Answers 2019 | Edureka
Top 50 .NET Interview Questions and Answers 2019 | EdurekaTop 50 .NET Interview Questions and Answers 2019 | Edureka
Top 50 .NET Interview Questions and Answers 2019 | Edureka
 
.Net framework
.Net framework.Net framework
.Net framework
 
Part 1
Part 1Part 1
Part 1
 
2. C# Guide - To Print
2. C# Guide - To Print2. C# Guide - To Print
2. C# Guide - To Print
 
CLR_via_CSharp_(Jeffrey_Richter_4th_Edition).pdf
CLR_via_CSharp_(Jeffrey_Richter_4th_Edition).pdfCLR_via_CSharp_(Jeffrey_Richter_4th_Edition).pdf
CLR_via_CSharp_(Jeffrey_Richter_4th_Edition).pdf
 
1 puc programming using c++
1 puc programming using c++1 puc programming using c++
1 puc programming using c++
 
Oops index
Oops indexOops index
Oops index
 
New microsoft office word document
New microsoft office word documentNew microsoft office word document
New microsoft office word document
 
New microsoft office word document
New microsoft office word documentNew microsoft office word document
New microsoft office word document
 
New microsoft office word document
New microsoft office word documentNew microsoft office word document
New microsoft office word document
 
Chapter1
Chapter1Chapter1
Chapter1
 
C# Unit 1 notes
C# Unit 1 notesC# Unit 1 notes
C# Unit 1 notes
 
21UCAC61 C# and .Net Programming.pdf(MTNC)(BCA)
21UCAC61 C# and .Net Programming.pdf(MTNC)(BCA)21UCAC61 C# and .Net Programming.pdf(MTNC)(BCA)
21UCAC61 C# and .Net Programming.pdf(MTNC)(BCA)
 
Bcsl 031 solve assignment
Bcsl 031 solve assignmentBcsl 031 solve assignment
Bcsl 031 solve assignment
 
Session2 (3)
Session2 (3)Session2 (3)
Session2 (3)
 

More from Reham Maher El-Safarini

Ux
Ux Ux
Global threat-landscape report by fortinet.
Global threat-landscape report by fortinet.Global threat-landscape report by fortinet.
Global threat-landscape report by fortinet.
Reham Maher El-Safarini
 
Dynamics AX/ X++
Dynamics AX/ X++Dynamics AX/ X++
Dynamics AX/ X++
Reham Maher El-Safarini
 
Microsoft sql-and-the-gdpr
Microsoft sql-and-the-gdprMicrosoft sql-and-the-gdpr
Microsoft sql-and-the-gdpr
Reham Maher El-Safarini
 
AWS Cloud economics
AWS Cloud economicsAWS Cloud economics
AWS Cloud economics
Reham Maher El-Safarini
 
Cloud skills development
Cloud skills developmentCloud skills development
Cloud skills development
Reham Maher El-Safarini
 
AWS cloud adoption framework (caf)
AWS cloud adoption framework (caf)AWS cloud adoption framework (caf)
AWS cloud adoption framework (caf)
Reham Maher El-Safarini
 
Application and database migration workshop
Application and database migration workshopApplication and database migration workshop
Application and database migration workshop
Reham Maher El-Safarini
 
Containers on AWS
Containers on AWSContainers on AWS
Containers on AWS
Reham Maher El-Safarini
 
Security and governance with aws control tower and aws organizations
Security and governance with aws control tower and aws organizationsSecurity and governance with aws control tower and aws organizations
Security and governance with aws control tower and aws organizations
Reham Maher El-Safarini
 
Digital transformation on aws
Digital transformation on awsDigital transformation on aws
Digital transformation on aws
Reham Maher El-Safarini
 
Security in the cloud
Security in the cloudSecurity in the cloud
Security in the cloud
Reham Maher El-Safarini
 
2. migration, disaster recovery and business continuity in the cloud
2. migration, disaster recovery and business continuity in the cloud2. migration, disaster recovery and business continuity in the cloud
2. migration, disaster recovery and business continuity in the cloud
Reham Maher El-Safarini
 
1. aws overview
1. aws overview1. aws overview
1. aws overview
Reham Maher El-Safarini
 
Pgp
PgpPgp
ssl for securing
ssl for securingssl for securing
ssl for securing
Reham Maher El-Safarini
 
03 unity 3_d_part_2
03 unity 3_d_part_203 unity 3_d_part_2
03 unity 3_d_part_2
Reham Maher El-Safarini
 
02 unity 3_d_part_1
02 unity 3_d_part_102 unity 3_d_part_1
02 unity 3_d_part_1
Reham Maher El-Safarini
 
01 unity 3_d_introduction
01 unity 3_d_introduction01 unity 3_d_introduction
01 unity 3_d_introduction
Reham Maher El-Safarini
 
unity basics
unity basicsunity basics

More from Reham Maher El-Safarini (20)

Ux
Ux Ux
Ux
 
Global threat-landscape report by fortinet.
Global threat-landscape report by fortinet.Global threat-landscape report by fortinet.
Global threat-landscape report by fortinet.
 
Dynamics AX/ X++
Dynamics AX/ X++Dynamics AX/ X++
Dynamics AX/ X++
 
Microsoft sql-and-the-gdpr
Microsoft sql-and-the-gdprMicrosoft sql-and-the-gdpr
Microsoft sql-and-the-gdpr
 
AWS Cloud economics
AWS Cloud economicsAWS Cloud economics
AWS Cloud economics
 
Cloud skills development
Cloud skills developmentCloud skills development
Cloud skills development
 
AWS cloud adoption framework (caf)
AWS cloud adoption framework (caf)AWS cloud adoption framework (caf)
AWS cloud adoption framework (caf)
 
Application and database migration workshop
Application and database migration workshopApplication and database migration workshop
Application and database migration workshop
 
Containers on AWS
Containers on AWSContainers on AWS
Containers on AWS
 
Security and governance with aws control tower and aws organizations
Security and governance with aws control tower and aws organizationsSecurity and governance with aws control tower and aws organizations
Security and governance with aws control tower and aws organizations
 
Digital transformation on aws
Digital transformation on awsDigital transformation on aws
Digital transformation on aws
 
Security in the cloud
Security in the cloudSecurity in the cloud
Security in the cloud
 
2. migration, disaster recovery and business continuity in the cloud
2. migration, disaster recovery and business continuity in the cloud2. migration, disaster recovery and business continuity in the cloud
2. migration, disaster recovery and business continuity in the cloud
 
1. aws overview
1. aws overview1. aws overview
1. aws overview
 
Pgp
PgpPgp
Pgp
 
ssl for securing
ssl for securingssl for securing
ssl for securing
 
03 unity 3_d_part_2
03 unity 3_d_part_203 unity 3_d_part_2
03 unity 3_d_part_2
 
02 unity 3_d_part_1
02 unity 3_d_part_102 unity 3_d_part_1
02 unity 3_d_part_1
 
01 unity 3_d_introduction
01 unity 3_d_introduction01 unity 3_d_introduction
01 unity 3_d_introduction
 
unity basics
unity basicsunity basics
unity basics
 

Recently uploaded

clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
Celine George
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
amberjdewit93
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
TechSoup
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
chanes7
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
National Information Standards Organization (NISO)
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
Celine George
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
taiba qazi
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
NgcHiNguyn25
 

Recently uploaded (20)

clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
 

Introduction to programming using c

  • 1. Introduction to programming using C# Eng. Reham M. El-Safarini
  • 2. •Outline: 2  History.  About C# Language.  .NET Framework Platform Architecture.  C# built-In types.  Namespace & Nested Namespace.  Object Oriented.  Visual Studio installation.  Hello world – First application.  Lab work.
  • 3. •History  In concurrence with the success of java programming language, the idea of new programming language starts to be under construction and it’s called C#. C# is simple managed C (SMC) compiler system unlike the C/C++ unmanaged language.  C# means musical note such as C/C++.  C# is an object oriented programming language which means it’s class based and developer can apply relations such as Inheritance , Encapsulation and Polymorphism.  It was released in 2000 and the project called .NET framework 3
  • 4. •About C# Language 4 C# syntax is highly expressive, yet it is also simple and easy to learn. The curly-brace syntax of C# will be instantly recognizable to anyone familiar with C, C++ or Java. Developers who know any of these languages are typically able to begin to work productively in C# within a very short time. C# syntax simplifies many of the complexities of C++ and provides powerful features such as nullable value types, enumerations, delegates, lambda expressions and direct memory access, which are not found in Java. C# supports generic methods and types, which provide increased type safety and performance, and iterators, which enable implementers of collection classes to define custom iteration behaviors that are simple to use by client code.
  • 5. •About C# Language-Cont. 5 Language-Integrated Query (LINQ) expressions make the strongly-typed query a first-class language construct. As an object-oriented language, C# supports the concepts of encapsulation, inheritance, and polymorphism. All variables and methods, including the Main method, the application's entry point, are encapsulated within class definitions. A class may inherit directly from one parent class, but it may implement any number of interfaces. Methods that override virtual methods in a parent class require the override keyword as a way to avoid accidental redefinition. In C#, a struct is like a lightweight class; it is a stack-allocated type that can implement interfaces but does not support inheritance. In addition to these basic object-oriented principles, C# makes it easy to develop software components through several innovative language constructs, including the following:
  • 6. •About C# Language-Cont. 6 Language-Integrated Query (LINQ) which provides built-in query capabilities across a variety of data sources. If you have to interact with other Windows software such as COM objects or native Win32 DLLs, you can do this in C# through a process called "Interop." Interop enables C# programs to do almost anything that a native C++ application can do. C# even supports pointers and the concept of "unsafe" code for those cases in which direct memory access is absolutely critical. The C# build process is simple compared to C and C++ and more flexible than in Java. There are no separate header files, and no requirement that methods and types be declared in a particular order. A C# source file may define any number of classes, structs, interfaces, and events.
  • 7. •.NET Framework Platform Architecture 7 The idea behind .NET Framework is to make a platform that can accept many languages and then compiler will handle it. C# programs run on the .NET Framework, an integral component of Windows that includes a virtual execution system called the common language runtime (CLR) and a unified set of class libraries. The CLR is the commercial implementation by Microsoft of the common language infrastructure (CLI), an international standard that is the basis for creating execution and development environments in which languages and libraries work together seamlessly. Source code written in C# is compiled into an intermediate language (IL) that conforms to the CLI specification. The IL code and resources, such as bitmaps and strings, are stored on disk in an executable file called an assembly, typically with an extension of .exe or .dll. An assembly contains a manifest that provides information about the assembly's types, version, culture, and security requirements.
  • 8. •.NET Framework Platform Architecture-Cont 8 When the C# program is executed, the assembly is loaded into the CLR, which might take various actions based on the information in the manifest. Then, if the security requirements are met, the CLR performs just in time (JIT) compilation to convert the IL code to native machine instructions. The CLR also provides other services related to automatic garbage collection, exception handling, and resource management. Code that is executed by the CLR is sometimes referred to as "managed code," in contrast to "unmanaged code" which is compiled into native machine language that targets a specific system. The following diagram illustrates the compile-time and run-time relationships of C# source code files, the .NET Framework class libraries, assemblies, and the CLR.
  • 9. •.NET Framework Platform Architecture-Cont 9
  • 10. •C# built-In types: 10 In order to define variables, developer needs to decide which type to choose for example if you want to define a number you need to declare a variable using int, for example: int number = 0; And so on. Type variable Assig n Initial value semicolon Left hand-side Right hand- side
  • 11. •C# built-In types – Cont.: 11 It is used to declare variables to store the Boolean values, true and false. The byte keyword denotes an integral type that stores values that ranges between 0-255, allocate size Unsigned 8-bit integer The char keyword is used to declare an instance of the System.Char structure that the .NET Framework uses to represent a Unicode character. The value of a Char object is a 16-bit numeric (ordinal) value. The byte keyword denotes an integral type that stores values that ranges between -128 to 127, allocate size signed 8-bit integer The decimal keyword indicates a 128-bit data type. Compared to floating-point types, the decimal type has more precision and a smaller range, which makes it appropriate for financial and monetary calculations. The approximate range is (-7.9 x 1028 to 7.9 x 1028) / (100 to 28) and precision for the decimal type is 28-29 significant digits The double keyword signifies a simple type that stores 64-bit floating-point values. The precision is ±5.0 × 10−324 to ±1.7 × 10308 and approximate range for the double type is 15-16 digits. The float keyword signifies a simple type that stores 32-bit floating-point values. The precision is 7 digits and approximate range for the float type is -3.4 × 1038to +3.4 × 1038. The int keyword denotes an integral type that stores values within Signed 32-bit integer size and within - 2,147,483,648 to 2,147,483,647 range The uint keyword signifies an integral type that stores values within Unsigned 32-bit integer size and within 0 to 4,294,967,295 range The long keyword denotes an integral type that stores values within Signed 64-bit integer size and within 9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 range The ulong keyword denotes an integral type that stores values within Unsigned 64-bit integer size and within 0 to 18,446,744,073,709,551,615 The object type is an alias for Object in the .NET Framework. In the unified type system of C#, all types, predefined and user-defined, reference types and value types, inherit directly or indirectly from Object. You can assign values of any type to variables of type object The short keyword denotes an integral data type that stores values within -32,768 to 32,767 size and within Signed 16-bit integer range . The ushort keyword indicates an integral data type that stores values within Unsigned 16-bit integer size and within 0 to 65,535 range . The string type represents a sequence of zero or more Unicode characters. string is an alias for String in the .NET Framework.
  • 12. •Namespace: 12 Namespaces are used to provide a "named space" in which your application resides. They're used especially to provide the C# compiler a context for all the named information in your program, such as variable names. Without namespaces, for example, you wouldn't be able to make a class named Console, as .NET already uses one in its System namespace. The purpose of namespaces is to solve this problem, and release thousands of names defined in the .NET Framework for your applications to use, along with making it so your application doesn't occupy names for other applications, if your application is intended to be used in conjunction with another. So namespaces exist to resolve ambiguities a compiler wouldn't otherwise be able to do.
  • 13. •Nested Namespace: 13 Normally, your entire application resides under its own special namespace, often named after your application or project name. Sometimes, companies with an entire product series decide to use nested namespaces though, where the "root" namespace can share the name of the company, and the nested namespaces the respective project names. This can be especially convenient, if you're a developer who has made a library with some usual functionality that can be shared across programs. If both the library and your program shared a parent namespace, that one would then not have to be explicitly declared with the using keyword, and still not have to be completely typed out. If your code was open for others to use, third party developers that may use your code would additionally then see that the same company had developed the library and the program. The developer of the library and program would finally also separate all the named information in their product source codes, for fewer headaches especially, if common names are used.
  • 14. •Object Oriented: 14 Object Oriented is a very important concept that every developer to be needs to know. The simple type int lets you declare integer variables as shown previously in slide 10 , and in the same way, you can create your own classes, which contain not only data like the simple types, but methods as well. Just as you create integer variables with the int type, so you create objects from classes. An integer variable is an instance of the int type, just like an object is an instance of a class. Classes are types, but are far more powerful than the simple types like int and float. Not only can you customize your data storage using classes, but you can also add methods to classes. That kind of compartmentalization—where data and methods are rolled up into a single class—is the entire reason that OOP was introduced in the first place. It enables the programmers to deal with larger programs. The process of wrapping related data and methods into a class (and so preventing them from cluttering up the rest of the program) to create a single entity is called encapsulation.
  • 15. •Object Oriented-Cont.: 15 You create classes in C# with the class statement: [attributes] [modifiers] class identifier [:base-list] { class-body }[;] Here are the parts of this statement:  attributes (Optional)—Attributes hold additional declarative information. modifiers (Optional)—The allowed modifiers are new, static, virtual, abstract, override, and a valid combination of the four access modifiers. identifier—The class name. n base-list (Optional)—A list that contains the base class and any implemented interfaces, separated by commas.  class-body—Declarations of the class members.
  • 16. •Object Oriented-Cont.: 16 Creating Objects To create an object, also called an instance, of a class, you use the new keyword. We’ve seen how this process works; you can see how we create a new object of the Calculator in exercise at last slide, AddItem method to add numbers. Note the parentheses after Calculator -highlighted with blue- in the statement Calculator obj = new Calculator();. These parentheses are necessary when you use the new keyword. They let you pass data to a class’s constructor, the special method that lets you initialize the data in a class.
  • 17. •Visual Studio installation 17 Definition : Visual studio is a Microsoft IDE(Integrated Development Environment) where a developer can install and use to create programs. To install VS you need to visit visualstudio and then select one of these products as shown in figure below
  • 18. •Visual Studio installation – Cont. 18 Once you click on the link, the execution file will automatically be downloaded. As shown in figure below,
  • 19. •Visual Studio installation – Cont. 19 A wizard will launch , press continue A waiting dialogue will start
  • 20. •Visual Studio installation – Cont. 20 Check the boxes and then press install
  • 21. •Visual Studio installation – Cont. 21 The installer will start acquiring to finally install the VS.
  • 22. •Visual Studio installation – Cont. 22 Now the installer has finished , press launch.
  • 23. •Visual Studio installation – Cont. 23 Sign in with your account, and if you don’t have one sign up for one, or you can press Not now , maybe later. Choose your color and then press start visual studio
  • 24. •Hello world 24 After successfully installing Visual studio now it’s time to create your first application. Select File -> New -> Project as shown in figure below,
  • 25. •Hello world – Cont. 25 Now select console application, and then type “Hello World” application. Then press Ok
  • 26. •Hello world – Cont. 26 Inside the main class type Console.WriteLine("Hello World"); . Press Ctrl+F5
  • 27. •Hello world – Cont. 27 Output:
  • 28. •Lab work: 28  Description: 1.Launch VS, and then create new project. 2.The project will be building a calculator that will add, subtract, divide and multiply numbers. 3.Apply Object oriented to the project. Challenge : try to create windows form application. Note: I will provide the solution next week.
  • 29. •References:  https://classes.soe.ucsc.edu/cmps020/Winter08/lectures /intro-csharp.pdf  https://msdn.microsoft.com/en-us/library/z1zx9t92.aspx  https://msdn.microsoft.com/en-us/library/ya5y69ds.aspx  https://en.wikibooks.org/wiki/C_Sharp_Programming/Na mespaces  http://catalogue.pearsoned.co.uk/samplechapter/067232 5470.pdf 29