microsoft tech club cairo university "mstc'16 builders and developers " third session

40
Introduction to C # Session #3 Prepared and Presented by A ya Zakaria W agdy Mohamed Microsoft

Upload: wagdy-mohamed

Post on 23-Jan-2017

384 views

Category:

Mobile


2 download

TRANSCRIPT

Page 1: Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Third Session

Introduction to C#

Session #3

Prepared and Presented byAya Zakaria Wagdy Mohamed

Microsoft

Page 2: Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Third Session

Agenda

• Arrays

• Functions

• Introduction to OOP

Page 3: Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Third Session

Arrays

Arrays

1D/2D

Static Dynamic

Page 4: Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Third Session

Static Array

Page 5: Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Third Session

Dynamic Array

Page 6: Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Third Session

1D and 2D array

int [ ] 1D= new int [4];

int [ , ] 2D= new int [3,3];

4 3 2 1

0 1 2 3

3 2 1

6 5 4

9 8 7

0

1

2

0 1 2

Elements

Index

Page 7: Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Third Session
Page 8: Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Third Session
Page 9: Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Third Session
Page 10: Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Third Session
Page 11: Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Third Session
Page 12: Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Third Session
Page 13: Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Third Session
Page 14: Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Third Session

Task Code

Page 15: Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Third Session
Page 16: Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Third Session
Page 17: Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Third Session

Functions

• Header

• Body

Page 18: Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Third Session

Function Header

• Access specifier

• Return type

• Function name

• Parameters

Page 19: Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Third Session

Access specifier

• This determines the visibility of a variable or a function from another class.

Public Private

Page 20: Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Third Session

Return type

• A function may return a value. The return type is the data type of the value the function returns. If the function is not returning any values, then the return type is void.

Page 21: Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Third Session

Function name

• Function name is a unique identifier and it is case sensitive. It cannot be same as any other identifier declared in the class.

Page 22: Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Third Session

Parameters

• Parameters are used to pass and receive data from a method

Page 23: Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Third Session

Function body

Page 24: Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Third Session
Page 25: Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Third Session
Page 26: Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Third Session
Page 27: Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Third Session

Introduction to OOP

• Class

• Object

• Setters and Getters

• Constructors

Page 28: Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Third Session

Class

Class: is a set of instructions to build a specific type of data

Page 29: Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Third Session

Object

Object: is keyword or component that contains properties and functions of class

Page 30: Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Third Session

Setters and Getters

Page 31: Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Third Session

Constructor

• Constructors: technique helps you to assign initial value to an object at the time of its creation and there are two types of constructors.

Page 32: Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Third Session

Default Constructor

• Default constructor: does not have any parameter

Implementation

Calling in main

Page 33: Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Third Session

Parameterized Constructor

Implementation

Calling in main

• Parameterized constructor: have parameters

Page 34: Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Third Session
Page 35: Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Third Session

Creating Class Car

Page 36: Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Third Session

Creating object from class Car

Page 37: Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Third Session
Page 38: Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Third Session
Page 39: Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Third Session

wagdy.mohamed.95

[email protected]

yoya.zakaria

[email protected]

Contacts

Page 40: Microsoft Tech Club Cairo University "MSTC'16 Builders and Developers " Third Session