SlideShare a Scribd company logo
1 of 22
C# Series, Week 0
Jamshid Hashimi, CodeWeekend
Agenda
• What is C#?
• Why C#?
• History of C#
• What is Object?
• Object Oriented Programming
• Managed Languages
• C# Syntax
• Installing C#
• Downloading and Installing Visual Studio
What is C#
• C# (pronounced "C-sharp") is an object-oriented programming
language from Microsoft that aims to combine the computing power
of C++ with the programming ease of Visual Basic. C# is based on C++
and contains features similar to those of Java.
• Designed by: Microsoft
• Developed by: Microsoft
• First Appeared at: 2000, 15 years ago
• Stable Release: 5.0
• Development Team Lead by: Anders Hejlsberg
Why C#?
• Modernized Language
• C# is a modernized version of C++
• It was C, then C++. Now it C#
• Type-safety
• You can not use uninitialized variables
• You can not walk past the end of an array
• Object Oriented
• C# goes to another level, even simple data types can be treated as Objects.
• Simplified Syntax
• C++ is powerful but not easy. C# is type safe, for example C# does away with Pointers. C# do not
allow direct memory manipulation, so pointers are not needed.
• Header files have also been removed from C#. The namespace and reference operators, :: and ->
respectively, have been replaced with a single operator, the period (.).
• int and bool data types are completely different now!
• C# removes memory management issues by using .NET garbage collection scheme.
Why C#?
• XML Comments
• Comments can be source code independent
• Not Just Microsoft
• Mono
• The power to be unsafe
• You can directly access to memory
• If you want to drive without a seatbelt, you are free to do so.
• Is a general purpose language
• Dev Productivity
History of C#
• January 1999: Anders Hejlsberg formed a team to build a new
language, named Cool, which stood for “C-like Object Oriented
Language”.
• July 2000, PDC: Language name changed to C#
• Anders Hejlsberg:
• C# Principle designer and lead architect
• Also designed Turbo Pascal and Delphi
• Stated: Flaws in other languages (e.g. C++, Java, Delphi, and Smalltalk) drove
the fundamentals of CLR, which, in return drove the design of C#.
• “It is not a clone of Java, it is much closer to C++ in its design”
• To many programmers, C# is Microsoft’s answer to Java.
History of C#
• The name
• Inspired by musical notation where a sharp indicates that the written note
should made a semitone higher in pitch.
• C++, means C incremented and C#, means C++ incremented. (# is made by
four +)
What is Object?
• Object is the foundational piece of object oriented programming language.
• An object typically makes a concept.
• An object is something e.g. customer
• An object has data e.g. customer’s first name
• An object performs action
• Make a customer preferred
• Color a car
• Change customer’s name
• Object is a thing
• To define a thing we need to talk about its characteristics.
What is Object?
• Suppose you are a Personnel Manager for a company and need to hire
someone in an important position.
• You select one resume, Jane
• You are Jack
• You call her
• Arrange an interview, she will fly to your location
• You two never met before, so started asking few questions from each other: height,
hair type, cloth color and briefcase color
• Without realizing it, you used objects in the course of your conversation
• You created a Person class. A class is a template used to describe an object.
• A class is an abstraction or simplification of some object your observe in the real
world.
• Objects has two basic components:
• Properties that describe the object
• Methods, or actions, that you want to associate with the object
What is Object?
Object Oriented Programming
• To be object oriented, a language is designed around the concept of
objects.
• Objects have certain properties as exhibits certain behaviors.
• It means language generally includes support for:
• Encapsulation
• Inheritance
• Polymorphism
Object Oriented Programming
• Encapsulation
• The wall around code
• I don’t want you to get confused
• I just want you get in touch with me with the Windows and Doors.
• A customer has a first name, but you don’t care how that’s stored. You just
want to get in and extract the information needed.
• We encapsulate to keep our code secure.
Object Oriented Programming
• Inheritance
• Fundamentally based on the idea of code reuse.
• You create behaviors, others can use it through inheritance channel.
• The quality you get from your parents 
Object Oriented Programming
Object Oriented Programming
• Polymorphism
• from Greek πολύς, polys, "many, much" and μορφή, morphē, "form, shape"
• Objects can appear in different shapes, forms.
• Instead of sticking with the concept of “many shapes”, perhaps the definition should
be amended to mean “many messages.”
• In essence Polymorphism means that you can send the same message to a group of
different classes and that each class will know how to respond correctly to that
message.
• clsBuilding – base class, RemoveSnow() - virtual
• clsApartment – RemoveSnow() - override
• clsCommercial – RemoveSnow() – override
• myApt.RemoveSnow()
• myComm.RemoveSnow()
• myHome.RemoveSnow() – We don’t have a RemoveSnow method for our clsHome object.
Still it outputs.
Managed Languages
• Managed language depends on services provided by a runtime
environment
• C# is one of many programming languages which it compiles into managed
code. (others are: F#, C++, VB and more..)
• Managed runtime in .NET is called Common Language Runtime (CLR)
• Common Language Runtime (CLR) provides:
• Automatic Memory Management
• Exception Handling
• Standard Types
• Security
Managed Languages
• Managed Code
• Managed code is a code that has its execution managed by .NET framework
Common Language Runtime (CLR)
• When you compile C# code to .exe, it is compiled to Common Intermediate
Language (CIL), bytecode.
• Whenever you run a CIL executable, it is executed on Microsoft Common
Language Runtime (CLR) virtual machine.
• You must have the .NET runtime installed on any client machines where your
program will be running.
• C# do not compiles directly to machine code. It compiles to CIL (bytecode).
CLR executes the bytecode to machine code.
C# Syntax
• C# syntax is based on C and C++ syntax
• Identifiers are names of classes, methods, variables and so on
• Console, Writeline, AcceptDetails(), GetArea(), length, width, Display and so
on.
• Keywords are compiler reserved words
• Public, class, string, get, set, void and so on.
• Using keyword is used to include namespaces inside our program.
C# Syntax
C# Syntax
C# Syntax
Thank You! 

More Related Content

Similar to C# Series Week 0 Introduction

CS4443 - Modern Programming Language - I Lecture (1)
CS4443 - Modern Programming Language - I Lecture (1)CS4443 - Modern Programming Language - I Lecture (1)
CS4443 - Modern Programming Language - I Lecture (1)Dilawar Khan
 
Programing fundamentals with C++
Programing fundamentals with C++Programing fundamentals with C++
Programing fundamentals with C++farooq2016
 
Advance C# Programming Part 1.pptx
Advance C# Programming Part 1.pptxAdvance C# Programming Part 1.pptx
Advance C# Programming Part 1.pptxpercivalfernandez3
 
Advance C# Programming Part 1.pdf
Advance C# Programming Part 1.pdfAdvance C# Programming Part 1.pdf
Advance C# Programming Part 1.pdfpercivalfernandez2
 
Xcode, Basics and Beyond
Xcode, Basics and BeyondXcode, Basics and Beyond
Xcode, Basics and Beyondrsebbe
 
C & C++ Training Centre in Ambala! BATRA COMPUTER CENTRE
C & C++ Training Centre in Ambala! BATRA COMPUTER CENTREC & C++ Training Centre in Ambala! BATRA COMPUTER CENTRE
C & C++ Training Centre in Ambala! BATRA COMPUTER CENTREjatin batra
 
Csharp introduction
Csharp introductionCsharp introduction
Csharp introductionSireesh K
 
Introduction to .NET
Introduction to .NETIntroduction to .NET
Introduction to .NETJoni
 
Session#1 csharp MTCS
Session#1 csharp MTCSSession#1 csharp MTCS
Session#1 csharp MTCSAhmad Ehab
 
Bootstrapping iPhone Development
Bootstrapping iPhone DevelopmentBootstrapping iPhone Development
Bootstrapping iPhone DevelopmentThoughtWorks
 
ASP.NET Session 3
ASP.NET Session 3ASP.NET Session 3
ASP.NET Session 3Sisir Ghosh
 

Similar to C# Series Week 0 Introduction (20)

CS4443 - Modern Programming Language - I Lecture (1)
CS4443 - Modern Programming Language - I Lecture (1)CS4443 - Modern Programming Language - I Lecture (1)
CS4443 - Modern Programming Language - I Lecture (1)
 
Programing fundamentals with C++
Programing fundamentals with C++Programing fundamentals with C++
Programing fundamentals with C++
 
Advance C# Programming Part 1.pptx
Advance C# Programming Part 1.pptxAdvance C# Programming Part 1.pptx
Advance C# Programming Part 1.pptx
 
Advance C# Programming Part 1.pdf
Advance C# Programming Part 1.pdfAdvance C# Programming Part 1.pdf
Advance C# Programming Part 1.pdf
 
Intro to .NET and Core C#
Intro to .NET and Core C#Intro to .NET and Core C#
Intro to .NET and Core C#
 
C sharp
C sharpC sharp
C sharp
 
Ios development
Ios developmentIos development
Ios development
 
Xcode, Basics and Beyond
Xcode, Basics and BeyondXcode, Basics and Beyond
Xcode, Basics and Beyond
 
C#
C#C#
C#
 
Lec1.pptx
Lec1.pptxLec1.pptx
Lec1.pptx
 
The Big Picture
The Big PictureThe Big Picture
The Big Picture
 
C_Programming_Notes_ICE
C_Programming_Notes_ICEC_Programming_Notes_ICE
C_Programming_Notes_ICE
 
C & C++ Training Centre in Ambala! BATRA COMPUTER CENTRE
C & C++ Training Centre in Ambala! BATRA COMPUTER CENTREC & C++ Training Centre in Ambala! BATRA COMPUTER CENTRE
C & C++ Training Centre in Ambala! BATRA COMPUTER CENTRE
 
Csharp introduction
Csharp introductionCsharp introduction
Csharp introduction
 
Lecture 4
Lecture 4Lecture 4
Lecture 4
 
Introduction to .NET
Introduction to .NETIntroduction to .NET
Introduction to .NET
 
Session#1 csharp MTCS
Session#1 csharp MTCSSession#1 csharp MTCS
Session#1 csharp MTCS
 
Bootstrapping iPhone Development
Bootstrapping iPhone DevelopmentBootstrapping iPhone Development
Bootstrapping iPhone Development
 
ASP.NET Session 3
ASP.NET Session 3ASP.NET Session 3
ASP.NET Session 3
 
C++ l 1
C++ l 1C++ l 1
C++ l 1
 

More from Jamshid Hashimi

Week 2: Getting Your Hands Dirty – Part 2
Week 2: Getting Your Hands Dirty – Part 2Week 2: Getting Your Hands Dirty – Part 2
Week 2: Getting Your Hands Dirty – Part 2Jamshid Hashimi
 
Week 1: Getting Your Hands Dirty - Part 1
Week 1: Getting Your Hands Dirty - Part 1Week 1: Getting Your Hands Dirty - Part 1
Week 1: Getting Your Hands Dirty - Part 1Jamshid Hashimi
 
RIST - Research Institute for Science and Technology
RIST - Research Institute for Science and TechnologyRIST - Research Institute for Science and Technology
RIST - Research Institute for Science and TechnologyJamshid Hashimi
 
How Coding Can Make Your Life Better
How Coding Can Make Your Life BetterHow Coding Can Make Your Life Better
How Coding Can Make Your Life BetterJamshid Hashimi
 
Tips for Writing Better Code
Tips for Writing Better CodeTips for Writing Better Code
Tips for Writing Better CodeJamshid Hashimi
 
Launch Your Local Blog & Social Media Integration
Launch Your Local Blog & Social Media IntegrationLaunch Your Local Blog & Social Media Integration
Launch Your Local Blog & Social Media IntegrationJamshid Hashimi
 
Introduction to Blogging
Introduction to BloggingIntroduction to Blogging
Introduction to BloggingJamshid Hashimi
 
Introduction to Wordpress
Introduction to WordpressIntroduction to Wordpress
Introduction to WordpressJamshid Hashimi
 
CodeIgniter Helper Functions
CodeIgniter Helper FunctionsCodeIgniter Helper Functions
CodeIgniter Helper FunctionsJamshid Hashimi
 
CodeIgniter Class Reference
CodeIgniter Class ReferenceCodeIgniter Class Reference
CodeIgniter Class ReferenceJamshid Hashimi
 
Managing Applications in CodeIgniter
Managing Applications in CodeIgniterManaging Applications in CodeIgniter
Managing Applications in CodeIgniterJamshid Hashimi
 
PHP Frameworks & Introduction to CodeIgniter
PHP Frameworks & Introduction to CodeIgniterPHP Frameworks & Introduction to CodeIgniter
PHP Frameworks & Introduction to CodeIgniterJamshid Hashimi
 

More from Jamshid Hashimi (20)

Week 2: Getting Your Hands Dirty – Part 2
Week 2: Getting Your Hands Dirty – Part 2Week 2: Getting Your Hands Dirty – Part 2
Week 2: Getting Your Hands Dirty – Part 2
 
Week 1: Getting Your Hands Dirty - Part 1
Week 1: Getting Your Hands Dirty - Part 1Week 1: Getting Your Hands Dirty - Part 1
Week 1: Getting Your Hands Dirty - Part 1
 
RIST - Research Institute for Science and Technology
RIST - Research Institute for Science and TechnologyRIST - Research Institute for Science and Technology
RIST - Research Institute for Science and Technology
 
How Coding Can Make Your Life Better
How Coding Can Make Your Life BetterHow Coding Can Make Your Life Better
How Coding Can Make Your Life Better
 
Mobile Vision
Mobile VisionMobile Vision
Mobile Vision
 
Tips for Writing Better Code
Tips for Writing Better CodeTips for Writing Better Code
Tips for Writing Better Code
 
Launch Your Local Blog & Social Media Integration
Launch Your Local Blog & Social Media IntegrationLaunch Your Local Blog & Social Media Integration
Launch Your Local Blog & Social Media Integration
 
Customizing Your Blog 2
Customizing Your Blog 2Customizing Your Blog 2
Customizing Your Blog 2
 
Customizing Your Blog 1
Customizing Your Blog 1Customizing Your Blog 1
Customizing Your Blog 1
 
Introduction to Blogging
Introduction to BloggingIntroduction to Blogging
Introduction to Blogging
 
Introduction to Wordpress
Introduction to WordpressIntroduction to Wordpress
Introduction to Wordpress
 
CodeIgniter Helper Functions
CodeIgniter Helper FunctionsCodeIgniter Helper Functions
CodeIgniter Helper Functions
 
CodeIgniter Class Reference
CodeIgniter Class ReferenceCodeIgniter Class Reference
CodeIgniter Class Reference
 
Managing Applications in CodeIgniter
Managing Applications in CodeIgniterManaging Applications in CodeIgniter
Managing Applications in CodeIgniter
 
CodeIgniter Practice
CodeIgniter PracticeCodeIgniter Practice
CodeIgniter Practice
 
CodeIgniter & MVC
CodeIgniter & MVCCodeIgniter & MVC
CodeIgniter & MVC
 
PHP Frameworks & Introduction to CodeIgniter
PHP Frameworks & Introduction to CodeIgniterPHP Frameworks & Introduction to CodeIgniter
PHP Frameworks & Introduction to CodeIgniter
 
Exception & Database
Exception & DatabaseException & Database
Exception & Database
 
MySQL Record Operations
MySQL Record OperationsMySQL Record Operations
MySQL Record Operations
 
MySQL JOIN & UNION
MySQL JOIN & UNIONMySQL JOIN & UNION
MySQL JOIN & UNION
 

Recently uploaded

Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 

Recently uploaded (20)

Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 

C# Series Week 0 Introduction

  • 1. C# Series, Week 0 Jamshid Hashimi, CodeWeekend
  • 2. Agenda • What is C#? • Why C#? • History of C# • What is Object? • Object Oriented Programming • Managed Languages • C# Syntax • Installing C# • Downloading and Installing Visual Studio
  • 3. What is C# • C# (pronounced "C-sharp") is an object-oriented programming language from Microsoft that aims to combine the computing power of C++ with the programming ease of Visual Basic. C# is based on C++ and contains features similar to those of Java. • Designed by: Microsoft • Developed by: Microsoft • First Appeared at: 2000, 15 years ago • Stable Release: 5.0 • Development Team Lead by: Anders Hejlsberg
  • 4. Why C#? • Modernized Language • C# is a modernized version of C++ • It was C, then C++. Now it C# • Type-safety • You can not use uninitialized variables • You can not walk past the end of an array • Object Oriented • C# goes to another level, even simple data types can be treated as Objects. • Simplified Syntax • C++ is powerful but not easy. C# is type safe, for example C# does away with Pointers. C# do not allow direct memory manipulation, so pointers are not needed. • Header files have also been removed from C#. The namespace and reference operators, :: and -> respectively, have been replaced with a single operator, the period (.). • int and bool data types are completely different now! • C# removes memory management issues by using .NET garbage collection scheme.
  • 5. Why C#? • XML Comments • Comments can be source code independent • Not Just Microsoft • Mono • The power to be unsafe • You can directly access to memory • If you want to drive without a seatbelt, you are free to do so. • Is a general purpose language • Dev Productivity
  • 6. History of C# • January 1999: Anders Hejlsberg formed a team to build a new language, named Cool, which stood for “C-like Object Oriented Language”. • July 2000, PDC: Language name changed to C# • Anders Hejlsberg: • C# Principle designer and lead architect • Also designed Turbo Pascal and Delphi • Stated: Flaws in other languages (e.g. C++, Java, Delphi, and Smalltalk) drove the fundamentals of CLR, which, in return drove the design of C#. • “It is not a clone of Java, it is much closer to C++ in its design” • To many programmers, C# is Microsoft’s answer to Java.
  • 7. History of C# • The name • Inspired by musical notation where a sharp indicates that the written note should made a semitone higher in pitch. • C++, means C incremented and C#, means C++ incremented. (# is made by four +)
  • 8. What is Object? • Object is the foundational piece of object oriented programming language. • An object typically makes a concept. • An object is something e.g. customer • An object has data e.g. customer’s first name • An object performs action • Make a customer preferred • Color a car • Change customer’s name • Object is a thing • To define a thing we need to talk about its characteristics.
  • 9. What is Object? • Suppose you are a Personnel Manager for a company and need to hire someone in an important position. • You select one resume, Jane • You are Jack • You call her • Arrange an interview, she will fly to your location • You two never met before, so started asking few questions from each other: height, hair type, cloth color and briefcase color • Without realizing it, you used objects in the course of your conversation • You created a Person class. A class is a template used to describe an object. • A class is an abstraction or simplification of some object your observe in the real world. • Objects has two basic components: • Properties that describe the object • Methods, or actions, that you want to associate with the object
  • 11. Object Oriented Programming • To be object oriented, a language is designed around the concept of objects. • Objects have certain properties as exhibits certain behaviors. • It means language generally includes support for: • Encapsulation • Inheritance • Polymorphism
  • 12. Object Oriented Programming • Encapsulation • The wall around code • I don’t want you to get confused • I just want you get in touch with me with the Windows and Doors. • A customer has a first name, but you don’t care how that’s stored. You just want to get in and extract the information needed. • We encapsulate to keep our code secure.
  • 13. Object Oriented Programming • Inheritance • Fundamentally based on the idea of code reuse. • You create behaviors, others can use it through inheritance channel. • The quality you get from your parents 
  • 15. Object Oriented Programming • Polymorphism • from Greek πολύς, polys, "many, much" and μορφή, morphē, "form, shape" • Objects can appear in different shapes, forms. • Instead of sticking with the concept of “many shapes”, perhaps the definition should be amended to mean “many messages.” • In essence Polymorphism means that you can send the same message to a group of different classes and that each class will know how to respond correctly to that message. • clsBuilding – base class, RemoveSnow() - virtual • clsApartment – RemoveSnow() - override • clsCommercial – RemoveSnow() – override • myApt.RemoveSnow() • myComm.RemoveSnow() • myHome.RemoveSnow() – We don’t have a RemoveSnow method for our clsHome object. Still it outputs.
  • 16. Managed Languages • Managed language depends on services provided by a runtime environment • C# is one of many programming languages which it compiles into managed code. (others are: F#, C++, VB and more..) • Managed runtime in .NET is called Common Language Runtime (CLR) • Common Language Runtime (CLR) provides: • Automatic Memory Management • Exception Handling • Standard Types • Security
  • 17. Managed Languages • Managed Code • Managed code is a code that has its execution managed by .NET framework Common Language Runtime (CLR) • When you compile C# code to .exe, it is compiled to Common Intermediate Language (CIL), bytecode. • Whenever you run a CIL executable, it is executed on Microsoft Common Language Runtime (CLR) virtual machine. • You must have the .NET runtime installed on any client machines where your program will be running. • C# do not compiles directly to machine code. It compiles to CIL (bytecode). CLR executes the bytecode to machine code.
  • 18. C# Syntax • C# syntax is based on C and C++ syntax • Identifiers are names of classes, methods, variables and so on • Console, Writeline, AcceptDetails(), GetArea(), length, width, Display and so on. • Keywords are compiler reserved words • Public, class, string, get, set, void and so on. • Using keyword is used to include namespaces inside our program.