c# language

14
C # Language Presented By: AKANKSHA SHUKLA

Upload: akanksha-shukla

Post on 12-Nov-2014

562 views

Category:

Technology


2 download

DESCRIPTION

C# programming for beginners

TRANSCRIPT

Page 1: C# language

C # LanguagePresented By: AKANKSHA SHUKLA

Page 2: C# language

CONETNTS

•The language•Syntax•Program Structure•Variable and data types•Assignment and initialization•Examples of declaration•Distinguishing features•Advantage over C++ and Java

Page 3: C# language

The Language

• The C# language is intended to be a simple, modern, general-purpose, object-oriented programming language.

• C#'s principal designer and lead architect at Microsoft is Anders Hejlsberg

• Version and Platform: In August 2012 C# 5.0 , .NET Framework 4.5, Visual Studio

2012

Page 4: C# language

C# Syntax

•C# has the following syntax:•; are used to denote the end of a

statement.•{ } are used to group statements like

methods (functions), methods into classes, and classes into namespaces.

•Variables are assigned using an =, but compared using ==.

•[ ] are used with arrays, both to declare them and to get a value at a given index in one of them.

Page 5: C# language

C# - Program Structure

A C# program basically consists of the following parts:

•Namespace declaration•A class•Class methods•Class attributes•A Main method•Statements & Expressions•Comments

Page 6: C# language

Variables & Data Types in C#

Byte String

Short Object Int Bool Long Decimal Float Char Double •<data_type> <variable_list>;

•variable_name = value;

Variable Declaration

Variable intializatio

n

Page 7: C# language

Examples of Declarations

Int myNumber = 20;

String myName = “Sygnet”;

String[ ] name = new string[20];

Int[ ,] score = new int [5,3] ;

Initializing variable myNumber with 20

Initializing name array of string

type

Initializing score array with (5 x 3)

Page 8: C# language

Hello program

Page 9: C# language

Distinguishing features

•C# supports strongly typed implicit variable keyword var.

•C# is platform dependent.•C# has strongly typed and verbose function

pointer support via the keyword delegate•A C# namespace provides the same level of

code isolation•C# supports a strict Boolean data type, bool.•Garbage collection addresses the problem of 

memory leaks.

Page 10: C# language

Distinguishing features Contd…•C#, unlike Java, supports Method

overloading.

•C# supports enumeration.

•C# supports Genrics.

•C# supports optional parameter.

Page 11: C# language
Page 12: C# language

C# programming language is used in

•ASP.NET or web services

• Windows GUI application

Page 13: C# language

Advantages over C++ and java

•Formalized concept of get-set methods, so the code becomes more legible

•More clean events management (using delegates)

Page 14: C# language