SlideShare uma empresa Scribd logo
1 de 13
OVERVIEW OF
What is C#?
 It is a computer-programming language developed by Microsoft
Corporation, USA.
 It is fully object-oriented language.
 Suitable for developing Web-based applications
 Designed for developing robust, reliable & durable components
to handle real-world applications.
Highlights of C#
 Derived from C/C++ family.
 It simplifies & modernizes C++.
 It is only component oriented language available today.
 It is a language designed for the .NET Framework.
 It is a concise, lean & modern language.
 It combines the best features of many commonly used languages: the
productivity of VB, the power of C++, & the elegance of Java.
 It is intrinsically object-oriented & web-enabled.
 It has a lean & consistent syntax.
 It is simple, robust & productive.
 Major parts of .NET Framework are actually coded in C#.
Why C# ?????
 The primary motivation while developing any language is the
concern that it able to handle the increasing complexity of programs
that are robust, durable & maintainable.
 The history of major languages developed is as follows:
BPCL B
C
C++
ANSI C
Oak
Java
ANSI C++
C#
1967 1970
1972
1983
1987
1991
1995
1996
2000
Dennis Ritchie
Bjarne Stroustrup
ANSI Committee
James Gostling
Sun MicroSystems
ANSI Committe
Microsoft
Martin Richards Ken Thompson
Continue….
 C & C++ languages suffer from a
number of shortcomings in
meeting World Wide Web
requirements & standards.
 Some are as follows:
1. The high complexity of language
2. They are not truly object oriented
3. They have poor type safety
4. They are not suitable for working
with new web technologies.
5. They do not support versioning
6. They are weak in consistency
7. Their poor compatibility with the
existing systems
 VB, a language promoted by
Microsoft for overcoming these
problems, is not truly object-
oriented and becomes
increasingly difficult to use when
systems become large.
 Java which is truly object-
oriented has not retained some
powerful C++ features such as
operator overloading.
 Java also lacks inter-operability
with code developed in other
languages.
 Microsoft therefore decided to
design a new language.
 The result is C#, a simple &
modern language that directly
addresses the needs of
component-based software
development.
 C# is a descendant of C++ which in turn is a
descendant of C as illustrated below:
C
C++
Java C# VB
Concept
ProductivityElegance
Concept
Component
Orientation
Object
Orentation
Power
Characteristics of C#
 Simple
 C# simplifies C++ by eliminating irksome operators such as ->,
::, and pointers.
 C# treats integers & Boolean data types as entirely different
types.
 Consistent
 C# supports an unified type system which eliminates the
problem of varying ranges of integer types.
 All types are treated as objects.
 Modern
 C# is called modern language because it supports:
 Automatic garbage collection
 Rich intrinsic model for error handling
 Decimal data types for financial applications
 Modern approach to debugging
 Robust security model
Continue….
 Object-Oriented
 C# is truly object-oriented. It supports:
 Encapsulation
 Inheritance
 Polymorphism
 Type-Safe
 Type safety promotes robust programs.
 C# incorporates number of type-safe measures:
 All dynamically allocated objects & arrays are initialized to
zero
 Use of any uninitialized variables produces an error message
by the compiler
 C# supports automatic garbage collection
 Version able
 Making new versions of software modules work with the
existing applications is known as versioning
 C# provides support for versioning with the help of new &
override keywords.
 Compatible
 C# enforces the .NET common
language specifications & therefore
allows inter-operation with other
.NET languages
 Interoperable
 C# provides support for using COM
objects, no matter what language
was used to author them.
 Flexible
 We may declare certain classes &
methods as ‘unsafe’ and then use
pointers to manipulate them.
Continue…
How Does C# differs from Java ?
1. C# has more primitive data types
2. Arrays are declared differently in C#
3. C# supports struct type & Java does not
4. Java does not provide for operator overloading
5. C# provides for better versioning support than Java
6. C# provides static constructors for initialization
7. Java does not directly support enumerations
8. C# uses is operator instead of instanceof operator in Java
9. C# checks overflows uses checked statements
10. There is no labeled break statement in C#. The goto statement is
used to achieve this.
11. In Java, the switch statement can have only integer expression,
while C# supports either an integer or string expressions
A Simple C# Program
class SampleOne
{
public static void Main()
{
System.Console.WriteLine(“C# is sharper than C++”);
}
}
 Executing the program
 Save the above file with SampleOne.cs name
 Compile as : csc SampleOne.cs
 C# compiler compiles your code and create an executable file by
name
 SampleOne.exe
 For executing the program, simply type in the name of the
executable file at the command prompt.
NAMESPACES
System.Console.WriteLine();
 Here System is a namespace in which the Console class is located.
 This class can be accessed using the dot operator.
 C# supports using directive that can be used to import the
namespace System into the program.
using System;
class SampleTwo
{
public static void Main()
{
Console.WriteLine(“Hello World!!!”);
}
}
Providing Interactive Input
using System;
class SampleEight
{
public static void Main(string[] args)
{
Console.Write(“Enter Your Name”);
string name = Console.ReadLine();
Console.WriteLine(“Hello ”+name);
}
}

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

C# Tutorial
C# Tutorial C# Tutorial
C# Tutorial
 
C# basics
 C# basics C# basics
C# basics
 
C# - Part 1
C# - Part 1C# - Part 1
C# - Part 1
 
C#.NET
C#.NETC#.NET
C#.NET
 
C sharp
C sharpC sharp
C sharp
 
Programming Fundamental Presentation
Programming Fundamental PresentationProgramming Fundamental Presentation
Programming Fundamental Presentation
 
Introduction To C#
Introduction To C#Introduction To C#
Introduction To C#
 
C# language
C# languageC# language
C# language
 
Introduction to c++ ppt 1
Introduction to c++ ppt 1Introduction to c++ ppt 1
Introduction to c++ ppt 1
 
Introduction to oops concepts
Introduction to oops conceptsIntroduction to oops concepts
Introduction to oops concepts
 
Programming Fundamentals lecture 1
Programming Fundamentals lecture 1Programming Fundamentals lecture 1
Programming Fundamentals lecture 1
 
C sharp
C sharpC sharp
C sharp
 
Java tutorial PPT
Java tutorial PPTJava tutorial PPT
Java tutorial PPT
 
Introduction to c++
Introduction to c++Introduction to c++
Introduction to c++
 
.NET Framework Overview
.NET Framework Overview.NET Framework Overview
.NET Framework Overview
 
Introduction to Basic C programming 01
Introduction to Basic C programming 01Introduction to Basic C programming 01
Introduction to Basic C programming 01
 
Introduction to .NET Framework
Introduction to .NET FrameworkIntroduction to .NET Framework
Introduction to .NET Framework
 
C++ language basic
C++ language basicC++ language basic
C++ language basic
 
C Programming Unit-1
C Programming Unit-1C Programming Unit-1
C Programming Unit-1
 
.NET and C# Introduction
.NET and C# Introduction.NET and C# Introduction
.NET and C# Introduction
 

Destaque

Lect 1. introduction to programming languages
Lect 1. introduction to programming languagesLect 1. introduction to programming languages
Lect 1. introduction to programming languagesVarun Garg
 
Functional Programming in C# and F#
Functional Programming in C# and F#Functional Programming in C# and F#
Functional Programming in C# and F#Alfonso Garcia-Caro
 
Computer Programming Overview
Computer Programming OverviewComputer Programming Overview
Computer Programming Overviewagorolabs
 
C Programming Language Tutorial for beginners - JavaTpoint
C Programming Language Tutorial for beginners - JavaTpointC Programming Language Tutorial for beginners - JavaTpoint
C Programming Language Tutorial for beginners - JavaTpointJavaTpoint.Com
 
Types of Software Testing
Types of Software TestingTypes of Software Testing
Types of Software TestingNishant Worah
 
Jira as a Tool for Test Management
Jira as a Tool for Test ManagementJira as a Tool for Test Management
Jira as a Tool for Test ManagementMaija Laksa
 
Using JIRA Software for Issue Tracking
Using JIRA Software for Issue TrackingUsing JIRA Software for Issue Tracking
Using JIRA Software for Issue TrackingAnjali Rao
 
INTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMINGINTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMINGAbhishek Dwivedi
 
Software Testing Basics
Software Testing BasicsSoftware Testing Basics
Software Testing BasicsBelal Raslan
 
C# coding standards, good programming principles & refactoring
C# coding standards, good programming principles & refactoringC# coding standards, good programming principles & refactoring
C# coding standards, good programming principles & refactoringEyob Lube
 
Basics of C programming
Basics of C programmingBasics of C programming
Basics of C programmingavikdhupar
 
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...Beat Signer
 
Introduction To Jira
Introduction To JiraIntroduction To Jira
Introduction To JiraHua Soon Sim
 
Introduction to JIRA & Agile Project Management
Introduction to JIRA & Agile Project ManagementIntroduction to JIRA & Agile Project Management
Introduction to JIRA & Agile Project ManagementDan Chuparkoff
 
Software Testing Fundamentals
Software Testing FundamentalsSoftware Testing Fundamentals
Software Testing FundamentalsChankey Pathak
 

Destaque (20)

Sql Overview
Sql OverviewSql Overview
Sql Overview
 
Lect 1. introduction to programming languages
Lect 1. introduction to programming languagesLect 1. introduction to programming languages
Lect 1. introduction to programming languages
 
Functional Programming in C# and F#
Functional Programming in C# and F#Functional Programming in C# and F#
Functional Programming in C# and F#
 
Introduction to Database SQL & PL/SQL
Introduction to Database SQL & PL/SQLIntroduction to Database SQL & PL/SQL
Introduction to Database SQL & PL/SQL
 
Computer Programming Overview
Computer Programming OverviewComputer Programming Overview
Computer Programming Overview
 
Programming in c#
Programming in c#Programming in c#
Programming in c#
 
Introduction to C Programming
Introduction to C ProgrammingIntroduction to C Programming
Introduction to C Programming
 
C Programming Language Tutorial for beginners - JavaTpoint
C Programming Language Tutorial for beginners - JavaTpointC Programming Language Tutorial for beginners - JavaTpoint
C Programming Language Tutorial for beginners - JavaTpoint
 
Types of Software Testing
Types of Software TestingTypes of Software Testing
Types of Software Testing
 
Dbms
DbmsDbms
Dbms
 
Jira as a Tool for Test Management
Jira as a Tool for Test ManagementJira as a Tool for Test Management
Jira as a Tool for Test Management
 
Using JIRA Software for Issue Tracking
Using JIRA Software for Issue TrackingUsing JIRA Software for Issue Tracking
Using JIRA Software for Issue Tracking
 
INTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMINGINTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMING
 
Software Testing Basics
Software Testing BasicsSoftware Testing Basics
Software Testing Basics
 
C# coding standards, good programming principles & refactoring
C# coding standards, good programming principles & refactoringC# coding standards, good programming principles & refactoring
C# coding standards, good programming principles & refactoring
 
Basics of C programming
Basics of C programmingBasics of C programming
Basics of C programming
 
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
 
Introduction To Jira
Introduction To JiraIntroduction To Jira
Introduction To Jira
 
Introduction to JIRA & Agile Project Management
Introduction to JIRA & Agile Project ManagementIntroduction to JIRA & Agile Project Management
Introduction to JIRA & Agile Project Management
 
Software Testing Fundamentals
Software Testing FundamentalsSoftware Testing Fundamentals
Software Testing Fundamentals
 

Semelhante a C# programming language

Semelhante a C# programming language (20)

Programming with c#
Programming with c#Programming with c#
Programming with c#
 
C# chap 1
C# chap 1C# chap 1
C# chap 1
 
C sharp chap1
C sharp chap1C sharp chap1
C sharp chap1
 
Event Driven Programming in C#.docx
Event Driven Programming in C#.docxEvent Driven Programming in C#.docx
Event Driven Programming in C#.docx
 
programming in c#.ppt
programming in c#.pptprogramming in c#.ppt
programming in c#.ppt
 
21UCAC61 C# and .Net Programming.pdf(MTNC)(BCA)
21UCAC61 C# and .Net Programming.pdf(MTNC)(BCA)21UCAC61 C# and .Net Programming.pdf(MTNC)(BCA)
21UCAC61 C# and .Net Programming.pdf(MTNC)(BCA)
 
Presentation1
Presentation1Presentation1
Presentation1
 
C# handout.docx
C# handout.docxC# handout.docx
C# handout.docx
 
C-sharping.docx
C-sharping.docxC-sharping.docx
C-sharping.docx
 
C#
C#C#
C#
 
C# vs Java What are The Differences.pdf
C# vs Java What are The Differences.pdfC# vs Java What are The Differences.pdf
C# vs Java What are The Differences.pdf
 
C#
C#C#
C#
 
DotNet Fundamentals
DotNet FundamentalsDotNet Fundamentals
DotNet Fundamentals
 
C#
C#C#
C#
 
Introduction to C Programming Language
Introduction to C Programming LanguageIntroduction to C Programming Language
Introduction to C Programming Language
 
Migrating From Cpp To C Sharp
Migrating From Cpp To C SharpMigrating From Cpp To C Sharp
Migrating From Cpp To C Sharp
 
C#.ppt
C#.pptC#.ppt
C#.ppt
 
Advance C# Programming Part 1.pptx
Advance C# Programming Part 1.pptxAdvance C# Programming Part 1.pptx
Advance C# Programming Part 1.pptx
 
Intro to c# (vs. objective c and java)
Intro to c# (vs. objective c and java)Intro to c# (vs. objective c and java)
Intro to c# (vs. objective c and java)
 
Intro to c# (vs. objective c and java)
Intro to c# (vs. objective c and java)Intro to c# (vs. objective c and java)
Intro to c# (vs. objective c and java)
 

Último

Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 

Último (20)

Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 

C# programming language

  • 2. What is C#?  It is a computer-programming language developed by Microsoft Corporation, USA.  It is fully object-oriented language.  Suitable for developing Web-based applications  Designed for developing robust, reliable & durable components to handle real-world applications.
  • 3. Highlights of C#  Derived from C/C++ family.  It simplifies & modernizes C++.  It is only component oriented language available today.  It is a language designed for the .NET Framework.  It is a concise, lean & modern language.  It combines the best features of many commonly used languages: the productivity of VB, the power of C++, & the elegance of Java.  It is intrinsically object-oriented & web-enabled.  It has a lean & consistent syntax.  It is simple, robust & productive.  Major parts of .NET Framework are actually coded in C#.
  • 4. Why C# ?????  The primary motivation while developing any language is the concern that it able to handle the increasing complexity of programs that are robust, durable & maintainable.  The history of major languages developed is as follows: BPCL B C C++ ANSI C Oak Java ANSI C++ C# 1967 1970 1972 1983 1987 1991 1995 1996 2000 Dennis Ritchie Bjarne Stroustrup ANSI Committee James Gostling Sun MicroSystems ANSI Committe Microsoft Martin Richards Ken Thompson
  • 5. Continue….  C & C++ languages suffer from a number of shortcomings in meeting World Wide Web requirements & standards.  Some are as follows: 1. The high complexity of language 2. They are not truly object oriented 3. They have poor type safety 4. They are not suitable for working with new web technologies. 5. They do not support versioning 6. They are weak in consistency 7. Their poor compatibility with the existing systems  VB, a language promoted by Microsoft for overcoming these problems, is not truly object- oriented and becomes increasingly difficult to use when systems become large.  Java which is truly object- oriented has not retained some powerful C++ features such as operator overloading.  Java also lacks inter-operability with code developed in other languages.  Microsoft therefore decided to design a new language.  The result is C#, a simple & modern language that directly addresses the needs of component-based software development.
  • 6.  C# is a descendant of C++ which in turn is a descendant of C as illustrated below: C C++ Java C# VB Concept ProductivityElegance Concept Component Orientation Object Orentation Power
  • 7. Characteristics of C#  Simple  C# simplifies C++ by eliminating irksome operators such as ->, ::, and pointers.  C# treats integers & Boolean data types as entirely different types.  Consistent  C# supports an unified type system which eliminates the problem of varying ranges of integer types.  All types are treated as objects.  Modern  C# is called modern language because it supports:  Automatic garbage collection  Rich intrinsic model for error handling  Decimal data types for financial applications  Modern approach to debugging  Robust security model
  • 8. Continue….  Object-Oriented  C# is truly object-oriented. It supports:  Encapsulation  Inheritance  Polymorphism  Type-Safe  Type safety promotes robust programs.  C# incorporates number of type-safe measures:  All dynamically allocated objects & arrays are initialized to zero  Use of any uninitialized variables produces an error message by the compiler  C# supports automatic garbage collection  Version able  Making new versions of software modules work with the existing applications is known as versioning  C# provides support for versioning with the help of new & override keywords.
  • 9.  Compatible  C# enforces the .NET common language specifications & therefore allows inter-operation with other .NET languages  Interoperable  C# provides support for using COM objects, no matter what language was used to author them.  Flexible  We may declare certain classes & methods as ‘unsafe’ and then use pointers to manipulate them. Continue…
  • 10. How Does C# differs from Java ? 1. C# has more primitive data types 2. Arrays are declared differently in C# 3. C# supports struct type & Java does not 4. Java does not provide for operator overloading 5. C# provides for better versioning support than Java 6. C# provides static constructors for initialization 7. Java does not directly support enumerations 8. C# uses is operator instead of instanceof operator in Java 9. C# checks overflows uses checked statements 10. There is no labeled break statement in C#. The goto statement is used to achieve this. 11. In Java, the switch statement can have only integer expression, while C# supports either an integer or string expressions
  • 11. A Simple C# Program class SampleOne { public static void Main() { System.Console.WriteLine(“C# is sharper than C++”); } }  Executing the program  Save the above file with SampleOne.cs name  Compile as : csc SampleOne.cs  C# compiler compiles your code and create an executable file by name  SampleOne.exe  For executing the program, simply type in the name of the executable file at the command prompt.
  • 12. NAMESPACES System.Console.WriteLine();  Here System is a namespace in which the Console class is located.  This class can be accessed using the dot operator.  C# supports using directive that can be used to import the namespace System into the program. using System; class SampleTwo { public static void Main() { Console.WriteLine(“Hello World!!!”); } }
  • 13. Providing Interactive Input using System; class SampleEight { public static void Main(string[] args) { Console.Write(“Enter Your Name”); string name = Console.ReadLine(); Console.WriteLine(“Hello ”+name); } }