c sharp fundamentals part i

Post on 20-May-2015

808 Views

Category:

Technology

4 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Maha EL-basuonyDot Net Framework-C Sharp

Agenda

Framework Before Dot Net

Dot Net Framework

Framework After Dot Net

Console Application

-Program Set of commands in logical order

-LLL(Low Level Language) collection of zeros & ones

Before Dot Net Framework

-Your applications written by High Level Language (HLL) But Your machine (Computer , Mobile , Projector ……..etc)

Understand only Low Level

Language (LLL) So Compiler Used

Com

piler

Java

Mac Mobile

Compiler JVM

Your Application

“VB6 ”

Windows

DOT NET Framework

CLR

More than 7000 Class

CLR

Java

Mac Mobile

Compiler JVM

VB.net

Windows

P.netC#.net

MSIL

.NET FRAMEWOR

K 1.0

.NET FRAMEWOR

K 1.1

.NET FRAMEWOR

K 2.0

.NET FRAMEWOR

K 3.5

.NET FRAMEWOR

K 4.0

Visual Studio.net 2002

Visual Studio.net 2003

Visual Studio.net 2005

Visual Studio.net 2008

Visual Studio.net 2010

.NET Framework Versions

C Sharp

Console Application

Windows Programming

Web Programming

-Writing a C# Program-Variables & Expressions

-Flow Control-More About Variables

-Functions-Debugging & Error Handling

Content

Writing a C# Program

Console.Write(“Hello World \n ”);

Console properties

Variables & ExpressionsDeclaring Variables

<Type> <VarName;>< Type> <VarName>=Value;

< Type> <Var1Name>,<Var2Name;..…>

Variables types

Integer Variables

Float Variables

String Variables

The basic variable naming rules are as follows:

1-First character of a variable name must be either (a letter, an underscore character ( .( _ ), at symbol ( @ ))

2-Subsequent characters may be letters, underscore characters, or numbers .

3-keywords that have a specialized meaning to the C# compiler, such as using ,namespace keywords

For example, the following variable names are fine:

myBigVar VAR1

_ test These are not, however:

99BottlesOfBeer namespace It’s-All-Over

Accept Values From User

ExpressionsMathematical

Operators

Assignment Operators

Examples

Operator Precedence

Flow Control

Boolean comparisons

Some other Boolean operators

go to Statement

The go to statement is used as follows :

goto < label Name >

Labels are defined as follows :

< label Name >

Selection Statements

-If statement -Ternary operator -Switch statement

If statement

if (expression){

do something}

if (expression) statement1

else Statement2

If-Else

Ternary operator

<expression > ? < resultIfTrue > : < resultIfFalse>

Switch statement

switch (expression) {

case constant-expression : // your code here

Break;

default :// your code here

Break; }

Iteration Statements

-For statement -While Statement

-do-while statement

For statement

for (initializers; expression; iterators) statement

While Statement

while (expression) statement

do-while statement

do statement while (expression) ;

Type Conversion

-Implicit conversion

-Implicit conversion-Explicit conversion

-Explicit conversion -Casting-Convert

-Enumerations -Structs-Arrays

Complex Variable Types

Enumerations

enum type Name

{ value1, value2, value3,

... valueN

}

enum typeName : underlyingType

{ value1 value2 value3

... valueN

}

enum typeName : underlyingType

{ value1 = actualVal1 value2 = actualVal2 value3 = actualVal3

... valueN = actualValN

}

enum typeName : underlyingType

{ value1 = actualVal1

value2 = value1 value3

... valueN = actualValN

}

Structs

struct < typeName > {

< memberDeclarations > }

Summary

- Dot Net Framework-Writing a C# Program

-Variables & Expressions-Flow Control

-More About Variables

Q & AThanks

top related