SlideShare a Scribd company logo
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 Introduction to C# - Week 0

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.pptx
percivalfernandez3
 
Advance C# Programming Part 1.pdf
Advance C# Programming Part 1.pdfAdvance C# Programming Part 1.pdf
Advance C# Programming Part 1.pdf
percivalfernandez2
 
C sharp
C sharpC sharp
C sharp
Ahmed Vic
 
Ios development
Ios developmentIos development
Ios development
Shakil Ahmed
 
Xcode, Basics and Beyond
Xcode, Basics and BeyondXcode, Basics and Beyond
Xcode, Basics and Beyondrsebbe
 
C#
C#C#
Lec1.pptx
Lec1.pptxLec1.pptx
Lec1.pptx
MunibaKhan12
 
The Big Picture
The Big PictureThe Big Picture
The Big Picture
Munazza-Mah-Jabeen
 
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
jatin batra
 
Csharp introduction
Csharp introductionCsharp introduction
Csharp introduction
Sireesh K
 
Lecture 4
Lecture 4Lecture 4
Lecture 4
Tanveer Malik
 
Introduction to .NET
Introduction to .NETIntroduction to .NET
Introduction to .NET
Joni
 
Session#1 csharp MTCS
Session#1 csharp MTCSSession#1 csharp MTCS
Session#1 csharp MTCS
Ahmad Ehab
 
Bootstrapping iPhone Development
Bootstrapping iPhone DevelopmentBootstrapping iPhone Development
Bootstrapping iPhone Development
ThoughtWorks
 
ASP.NET Session 3
ASP.NET Session 3ASP.NET Session 3
ASP.NET Session 3Sisir Ghosh
 

Similar to Introduction to C# - Week 0 (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 2
Jamshid 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 1
Jamshid 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 Technology
Jamshid 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 Better
Jamshid Hashimi
 
Mobile Vision
Mobile VisionMobile Vision
Mobile Vision
Jamshid Hashimi
 
Tips for Writing Better Code
Tips for Writing Better CodeTips for Writing Better Code
Tips for Writing Better Code
Jamshid 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 Integration
Jamshid Hashimi
 
Customizing Your Blog 2
Customizing Your Blog 2Customizing Your Blog 2
Customizing Your Blog 2
Jamshid Hashimi
 
Customizing Your Blog 1
Customizing Your Blog 1Customizing Your Blog 1
Customizing Your Blog 1
Jamshid Hashimi
 
Introduction to Blogging
Introduction to BloggingIntroduction to Blogging
Introduction to Blogging
Jamshid Hashimi
 
Introduction to Wordpress
Introduction to WordpressIntroduction to Wordpress
Introduction to Wordpress
Jamshid Hashimi
 
CodeIgniter Helper Functions
CodeIgniter Helper FunctionsCodeIgniter Helper Functions
CodeIgniter Helper FunctionsJamshid Hashimi
 
CodeIgniter Class Reference
CodeIgniter Class ReferenceCodeIgniter Class Reference
CodeIgniter Class Reference
Jamshid Hashimi
 
Managing Applications in CodeIgniter
Managing Applications in CodeIgniterManaging Applications in CodeIgniter
Managing Applications in CodeIgniterJamshid Hashimi
 
CodeIgniter Practice
CodeIgniter PracticeCodeIgniter Practice
CodeIgniter Practice
Jamshid 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

Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
UiPathCommunity
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.
ViralQR
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 

Recently uploaded (20)

Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 

Introduction to C# - Week 0

  • 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.