session4 csharp

36

Upload: muhammad-hesham

Post on 12-Apr-2017

63 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: Session4 csharp
Page 2: Session4 csharp

AW

Prepared and presented by : Muhammad Hesham & Mustafa Saeed

Aspiration Webbers Session 4 (C#)

Page 3: Session4 csharp

1.Reko meet C# (Brief history)

2.What C# can do (New Comers)

3.Architecture of .NET Applications4.Data types5.C# syntax

Page 4: Session4 csharp

C#

Page 5: Session4 csharp
Page 6: Session4 csharp

New Comer

Page 7: Session4 csharp

Editors

Visual Studio Code

IDE

Visual studio

Page 8: Session4 csharp

CLR

Page 9: Session4 csharp

Library

namespace

class

method

statement

Architecture of .NET Applications

Page 10: Session4 csharp

Architecture of .NET Applications

namespace ConsoleApplication

using System;

public static void Main()

public class Program

Console.WriteLine("Hello World!");

Librarynamespaceclassmethodstatement

Page 11: Session4 csharp

Data types

Page 12: Session4 csharp

Syntax

// Comment

Variables Comments

/*Commentscomment

*/

int x = 20 ; String name = “Reko” ; char z = ‘R’ ;

Page 13: Session4 csharp

Operators Addition+Subtraction-Multiplication*Division/Modulus%Increment

Decrement

++- -

int x = 2010% ;

int x = 2010- ; int x = 2010* ; int x = 2010/ ;

int x = 2010+ ;

x++; x--; int x =

int x =20;20 ;

And&&Or||

Page 14: Session4 csharp

namespace

namespace ConsoleApp1{

}

Page 15: Session4 csharp

Data Name

Age

Address

Actions Walk()

Talk()

Sleep()

Class

Page 16: Session4 csharp

class

class Program{

}

namespace ConsoleApp1{

}

Page 17: Session4 csharp

public class Person { public int Age { get; set; } public string FirstName { get; set; } public string LastName { get; set; }

public void WhatIsMyName() { }

public int Calculate(int firstNum, int secondNum) { } }

Object

Class

Page 18: Session4 csharp

methodclass Program{

}

namespace ConsoleApp1{

}

static void Main(string[] args){

}

Page 19: Session4 csharp

Person myPerson = new Person();

myPerson.FirstName = "Reko"; myPerson.LastName = "MSP"; myPerson.Age = 17;

myPerson.WhatIsMyName();

var result = myPerson.Calculate(10, 20); Console.WriteLine(result);

Object

Page 20: Session4 csharp

method

public class Program{

}

namespace sessionFourDemo{

}

static void Main(string[] args) { Console.WriteLine(“Hello World”); }

Page 21: Session4 csharp

method

public class Program{

}

namespace sessionFourDemo{

}

static void Main(string[] args) { String name = Console.ReadLine(); Console.WriteLine(name); }

Page 22: Session4 csharp

New class New method

private class Person{

}

namespace sessionFourDemo{

}

public void WhatIsMyName() { Console.WriteLine(“Hello world"); }

Page 23: Session4 csharp

public class Program{

}

namespace sessionFourDemo{

}

static void Main(string[] args) { Console.WriteLine(WhatIsMyName()); }

Page 24: Session4 csharp

New class New method

public class Person{

}

namespace sessionFourDemo{

}

public int Calcu(int ftNum , int snNum) { return ftNum + snNum; }

Page 25: Session4 csharp

public class Program{

}

namespace sessionFourDemo{

}

static void Main(string[] args) { Console.WriteLine(Calcu(5,3)); }

8

Page 26: Session4 csharp

if

Page 27: Session4 csharp

Switch

Page 28: Session4 csharp

For .. Loop

Page 29: Session4 csharp

While ..Loop

Page 30: Session4 csharp

array

Page 31: Session4 csharp

lists

Page 32: Session4 csharp

For each

Page 33: Session4 csharp

Demo

Page 34: Session4 csharp

Any Questions ?

Page 36: Session4 csharp

Thank you