c# language
DESCRIPTION
C# programming for beginnersTRANSCRIPT
C # LanguagePresented By: AKANKSHA SHUKLA
CONETNTS
•The language•Syntax•Program Structure•Variable and data types•Assignment and initialization•Examples of declaration•Distinguishing features•Advantage over C++ and Java
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
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.
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
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
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)
Hello program
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.
Distinguishing features Contd…•C#, unlike Java, supports Method
overloading.
•C# supports enumeration.
•C# supports Genrics.
•C# supports optional parameter.
C# programming language is used in
•ASP.NET or web services
• Windows GUI application
Advantages over C++ and java
•Formalized concept of get-set methods, so the code becomes more legible
•More clean events management (using delegates)