SlideShare uma empresa Scribd logo
1 de 6
Baixar para ler offline
The C# Language




                          Johan Franzén




C# – Overview

                Panel 1                   Panel 2

  Object Oriented (similar to Java)

  Appeared in 2001

  .NET Platform (VB.NET, J#, Managed C++ and more)

  Microsoft Windows

  Linux and Mac OS X with the mono project




                                                     1
C# – Common Language Infrastructure

               Panel 1         Panel 2




C# – Hello World

                               Panel 2

  using System;

  class Hello
  {
     static void Main() {
        Console.WriteLine(quot;Hello
        Console.WriteLine(quot;Hello worldquot;);
     }
  }




                                            2
C# – Data types

  int                                           Panel 2

  float
  string
  byte
  bool
  .
  .
  .

  float fValue = 2.0f;
  double dValue = 2.0;

  bool bValue = 5 (incorrect)




C# – Value Types and Reference Types

                       Panel 1                  Panel 2

  Value Types                                Value Type
                                             Point is a Struct
  By Value (copy)                            Point p1 = new Point();
                                             Point p2 = p1;
  int, float, … , Point, Vector2 (structs)
                                             (p2 is a copy of p1)
  Reference Types
  By Reference (reference)
                                             Reference Type
  Classes
                                             Person is a Class
                                             Person p1 = new Person();
                                                             Person();
                                             Person p2 = p1;

                                             (p2 points to the same
                                             object as p1)




                                                                         3
C# – Array & List

   Array (fixed size)

     int[]
     int[] myArray = new int[10];
                         int[10];

     myArray[2]
     myArray[2] = 3;




   List (can grow)

     List<int>
     List<int> myList = new List<int>();
                            List<int>();

     myList.Add(3);
     myList.Add(3);

     int myValue = myList[0];
                   myList[0];




C# – Iteration

   Standard for loop

      o
     for( t              y st Cou tt;
                        myList.Count;
     for(int i = 0; i < myList.Count; i++) {
                                         )
        Console.WriteLine(myList[
        Console.WriteLine(myList[i]);
     }



   foreach loop

     foreach(
     foreach(int value in myList) {
                          myList)
        Console.WriteLine( l )
        Console.WriteLine(value);
        C    l W it Li (value);
     }




                                               4
C# – get/set methods

   Java           Panel 1
   ------------------------------------------------
   class Person {
      private int age;

     public int getAge() { return age; }
                getAge()

     public void setAge(int value) {
                  setAge(
        if(age
        if(age >= 0)
           age = value;
     }
   }
   ------------------------------------------------
   Person p = new Person();
                  Person();
   p.setAge(20);
   p.setAge(20);
   int age = p.getAge();
             p.getAge();




C# – Properties

   C#             Panel 1           Panel 2
   ------------------------------------------------
   class Person {
      private int age;

     public int Age {
        get { return age; }
        set {
           if(age
           if(age >= 0)
              age = value;
                    value;
        }
     }
   }
   ------------------------------------------------
   Person p = new Person();
                  Person();
   p.Age = 20;
   int age = p.Age;
             p.Age;




                                                      5
ACTION




         6

Mais conteúdo relacionado

Mais procurados

C++ Programming - 1st Study
C++ Programming - 1st StudyC++ Programming - 1st Study
C++ Programming - 1st StudyChris Ohk
 
[C++ Korea] Effective Modern C++ Study, Item 11 - 13
[C++ Korea] Effective Modern C++ Study, Item 11 - 13[C++ Korea] Effective Modern C++ Study, Item 11 - 13
[C++ Korea] Effective Modern C++ Study, Item 11 - 13Chris Ohk
 
Practical Class 12th (c++programs+sql queries and output)
Practical Class 12th (c++programs+sql queries and output) Practical Class 12th (c++programs+sql queries and output)
Practical Class 12th (c++programs+sql queries and output) Aman Deep
 
C++ Programming - 11th Study
C++ Programming - 11th StudyC++ Programming - 11th Study
C++ Programming - 11th StudyChris Ohk
 
Mirror, mirror on the wall - Building a new PHP reflection library (Nomad PHP...
Mirror, mirror on the wall - Building a new PHP reflection library (Nomad PHP...Mirror, mirror on the wall - Building a new PHP reflection library (Nomad PHP...
Mirror, mirror on the wall - Building a new PHP reflection library (Nomad PHP...James Titcumb
 
Doublylinklist
DoublylinklistDoublylinklist
Doublylinklistritu1806
 
Short intro to the Rust language
Short intro to the Rust languageShort intro to the Rust language
Short intro to the Rust languageGines Espada
 
Writing a compiler in go
Writing a compiler in goWriting a compiler in go
Writing a compiler in goYusuke Kita
 
project report in C++ programming and SQL
project report in C++ programming and SQLproject report in C++ programming and SQL
project report in C++ programming and SQLvikram mahendra
 

Mais procurados (20)

Stl algorithm-Basic types
Stl algorithm-Basic typesStl algorithm-Basic types
Stl algorithm-Basic types
 
Implementing stack
Implementing stackImplementing stack
Implementing stack
 
C++ Programming - 1st Study
C++ Programming - 1st StudyC++ Programming - 1st Study
C++ Programming - 1st Study
 
Static and const members
Static and const membersStatic and const members
Static and const members
 
Codejunk Ignitesd
Codejunk IgnitesdCodejunk Ignitesd
Codejunk Ignitesd
 
informatics practices practical file
informatics practices practical fileinformatics practices practical file
informatics practices practical file
 
String Manipulation Function and Header File Functions
String Manipulation Function and Header File FunctionsString Manipulation Function and Header File Functions
String Manipulation Function and Header File Functions
 
C programs
C programsC programs
C programs
 
C Prog - Array
C Prog - ArrayC Prog - Array
C Prog - Array
 
[C++ Korea] Effective Modern C++ Study, Item 11 - 13
[C++ Korea] Effective Modern C++ Study, Item 11 - 13[C++ Korea] Effective Modern C++ Study, Item 11 - 13
[C++ Korea] Effective Modern C++ Study, Item 11 - 13
 
cosc 281 hw2
cosc 281 hw2cosc 281 hw2
cosc 281 hw2
 
Practical Class 12th (c++programs+sql queries and output)
Practical Class 12th (c++programs+sql queries and output) Practical Class 12th (c++programs+sql queries and output)
Practical Class 12th (c++programs+sql queries and output)
 
C++ Programming - 11th Study
C++ Programming - 11th StudyC++ Programming - 11th Study
C++ Programming - 11th Study
 
Mirror, mirror on the wall - Building a new PHP reflection library (Nomad PHP...
Mirror, mirror on the wall - Building a new PHP reflection library (Nomad PHP...Mirror, mirror on the wall - Building a new PHP reflection library (Nomad PHP...
Mirror, mirror on the wall - Building a new PHP reflection library (Nomad PHP...
 
Doublylinklist
DoublylinklistDoublylinklist
Doublylinklist
 
Short intro to the Rust language
Short intro to the Rust languageShort intro to the Rust language
Short intro to the Rust language
 
Elf文件解析
Elf文件解析Elf文件解析
Elf文件解析
 
Writing a compiler in go
Writing a compiler in goWriting a compiler in go
Writing a compiler in go
 
project report in C++ programming and SQL
project report in C++ programming and SQLproject report in C++ programming and SQL
project report in C++ programming and SQL
 
week-20x
week-20xweek-20x
week-20x
 

Destaque

Rotation and Tessellation
Rotation and TessellationRotation and Tessellation
Rotation and TessellationJeanette Murphy
 
Stpm Pam Kertas2 Set2
Stpm Pam Kertas2 Set2Stpm Pam Kertas2 Set2
Stpm Pam Kertas2 Set2Kay Aniza
 
Skema Bm Kertas1 Set2
Skema Bm Kertas1 Set2Skema Bm Kertas1 Set2
Skema Bm Kertas1 Set2Kay Aniza
 
Meteor is Coming
Meteor is ComingMeteor is Coming
Meteor is ComingDaniel Teng
 
Advanced Blogging
Advanced BloggingAdvanced Blogging
Advanced Bloggingmythicgroup
 
Análisis exergético de sistemas industriales de aire comprimido
Análisis exergético de sistemas industriales de aire comprimidoAnálisis exergético de sistemas industriales de aire comprimido
Análisis exergético de sistemas industriales de aire comprimidoCarlos Alderetes
 
Smc073 11 april 2012 Vught
Smc073 11 april 2012 VughtSmc073 11 april 2012 Vught
Smc073 11 april 2012 VughtBart Brouwers
 
Management Final Project Fall 2008
Management Final Project Fall 2008Management Final Project Fall 2008
Management Final Project Fall 2008lat886
 
LambdaDay: Backbone.js
LambdaDay: Backbone.jsLambdaDay: Backbone.js
LambdaDay: Backbone.jsGiovanni Bassi
 
Zipmark product and market overview
Zipmark product and market overviewZipmark product and market overview
Zipmark product and market overviewJayastu Bhattacharya
 
E learners presentation 2010
E learners presentation 2010E learners presentation 2010
E learners presentation 2010Jeanette Murphy
 

Destaque (20)

Mobile Development
Mobile DevelopmentMobile Development
Mobile Development
 
Corei7
Corei7Corei7
Corei7
 
BDD no mundo real
BDD no mundo realBDD no mundo real
BDD no mundo real
 
Rotation and Tessellation
Rotation and TessellationRotation and Tessellation
Rotation and Tessellation
 
Stpm Pam Kertas2 Set2
Stpm Pam Kertas2 Set2Stpm Pam Kertas2 Set2
Stpm Pam Kertas2 Set2
 
Skema Bm Kertas1 Set2
Skema Bm Kertas1 Set2Skema Bm Kertas1 Set2
Skema Bm Kertas1 Set2
 
Meteor is Coming
Meteor is ComingMeteor is Coming
Meteor is Coming
 
Advanced Blogging
Advanced BloggingAdvanced Blogging
Advanced Blogging
 
Puertos De Comunicacion
Puertos De ComunicacionPuertos De Comunicacion
Puertos De Comunicacion
 
Análisis exergético de sistemas industriales de aire comprimido
Análisis exergético de sistemas industriales de aire comprimidoAnálisis exergético de sistemas industriales de aire comprimido
Análisis exergético de sistemas industriales de aire comprimido
 
Scavenger Hunt Collage
Scavenger Hunt CollageScavenger Hunt Collage
Scavenger Hunt Collage
 
Smc073 11 april 2012 Vught
Smc073 11 april 2012 VughtSmc073 11 april 2012 Vught
Smc073 11 april 2012 Vught
 
Moss Week 12 Final With Answers
Moss   Week 12   Final   With AnswersMoss   Week 12   Final   With Answers
Moss Week 12 Final With Answers
 
Wood
WoodWood
Wood
 
side_face samples
side_face samplesside_face samples
side_face samples
 
911 Jour 1
911  Jour 1911  Jour 1
911 Jour 1
 
Management Final Project Fall 2008
Management Final Project Fall 2008Management Final Project Fall 2008
Management Final Project Fall 2008
 
LambdaDay: Backbone.js
LambdaDay: Backbone.jsLambdaDay: Backbone.js
LambdaDay: Backbone.js
 
Zipmark product and market overview
Zipmark product and market overviewZipmark product and market overview
Zipmark product and market overview
 
E learners presentation 2010
E learners presentation 2010E learners presentation 2010
E learners presentation 2010
 

Semelhante a C Sharp Lecture Johan Franzen

Computer science-2010-cbse-question-paper
Computer science-2010-cbse-question-paperComputer science-2010-cbse-question-paper
Computer science-2010-cbse-question-paperDeepak Singh
 
โปรแกรมย่อยและฟังชั่นมาตรฐาน ม.6 1
โปรแกรมย่อยและฟังชั่นมาตรฐาน ม.6 1โปรแกรมย่อยและฟังชั่นมาตรฐาน ม.6 1
โปรแกรมย่อยและฟังชั่นมาตรฐาน ม.6 1Little Tukta Lita
 
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6 1
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6  1ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6  1
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6 1Little Tukta Lita
 
Lecture 4: Data Types
Lecture 4: Data TypesLecture 4: Data Types
Lecture 4: Data TypesEelco Visser
 
C# Summer course - Lecture 2
C# Summer course - Lecture 2C# Summer course - Lecture 2
C# Summer course - Lecture 2mohamedsamyali
 
Dr archana dhawan bajaj - csharp fundamentals slides
Dr archana dhawan bajaj - csharp fundamentals slidesDr archana dhawan bajaj - csharp fundamentals slides
Dr archana dhawan bajaj - csharp fundamentals slidesDr-archana-dhawan-bajaj
 
Boost.Interfaces
Boost.InterfacesBoost.Interfaces
Boost.Interfacesmelpon
 
An Introduction to Part of C++ STL
An Introduction to Part of C++ STLAn Introduction to Part of C++ STL
An Introduction to Part of C++ STL乐群 陈
 
Java Simple Programs
Java Simple ProgramsJava Simple Programs
Java Simple ProgramsUpender Upr
 
Lies Told By The Kotlin Compiler
Lies Told By The Kotlin CompilerLies Told By The Kotlin Compiler
Lies Told By The Kotlin CompilerGarth Gilmour
 
Introduction to csharp
Introduction to csharpIntroduction to csharp
Introduction to csharpvoegtu
 

Semelhante a C Sharp Lecture Johan Franzen (20)

TechTalk - Dotnet
TechTalk - DotnetTechTalk - Dotnet
TechTalk - Dotnet
 
Computer science-2010-cbse-question-paper
Computer science-2010-cbse-question-paperComputer science-2010-cbse-question-paper
Computer science-2010-cbse-question-paper
 
โปรแกรมย่อยและฟังชั่นมาตรฐาน ม.6 1
โปรแกรมย่อยและฟังชั่นมาตรฐาน ม.6 1โปรแกรมย่อยและฟังชั่นมาตรฐาน ม.6 1
โปรแกรมย่อยและฟังชั่นมาตรฐาน ม.6 1
 
C++11
C++11C++11
C++11
 
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6 1
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6  1ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6  1
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6 1
 
Lezione03
Lezione03Lezione03
Lezione03
 
Lezione03
Lezione03Lezione03
Lezione03
 
Lecture 4: Data Types
Lecture 4: Data TypesLecture 4: Data Types
Lecture 4: Data Types
 
C#
C#C#
C#
 
C# Summer course - Lecture 2
C# Summer course - Lecture 2C# Summer course - Lecture 2
C# Summer course - Lecture 2
 
Python tour
Python tourPython tour
Python tour
 
Grammarware Memes
Grammarware MemesGrammarware Memes
Grammarware Memes
 
Why Learn Python?
Why Learn Python?Why Learn Python?
Why Learn Python?
 
Dr archana dhawan bajaj - csharp fundamentals slides
Dr archana dhawan bajaj - csharp fundamentals slidesDr archana dhawan bajaj - csharp fundamentals slides
Dr archana dhawan bajaj - csharp fundamentals slides
 
ASP.NET
ASP.NETASP.NET
ASP.NET
 
Boost.Interfaces
Boost.InterfacesBoost.Interfaces
Boost.Interfaces
 
An Introduction to Part of C++ STL
An Introduction to Part of C++ STLAn Introduction to Part of C++ STL
An Introduction to Part of C++ STL
 
Java Simple Programs
Java Simple ProgramsJava Simple Programs
Java Simple Programs
 
Lies Told By The Kotlin Compiler
Lies Told By The Kotlin CompilerLies Told By The Kotlin Compiler
Lies Told By The Kotlin Compiler
 
Introduction to csharp
Introduction to csharpIntroduction to csharp
Introduction to csharp
 

Último

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 

Último (20)

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 

C Sharp Lecture Johan Franzen

  • 1. The C# Language Johan Franzén C# – Overview Panel 1 Panel 2 Object Oriented (similar to Java) Appeared in 2001 .NET Platform (VB.NET, J#, Managed C++ and more) Microsoft Windows Linux and Mac OS X with the mono project 1
  • 2. C# – Common Language Infrastructure Panel 1 Panel 2 C# – Hello World Panel 2 using System; class Hello { static void Main() { Console.WriteLine(quot;Hello Console.WriteLine(quot;Hello worldquot;); } } 2
  • 3. C# – Data types int Panel 2 float string byte bool . . . float fValue = 2.0f; double dValue = 2.0; bool bValue = 5 (incorrect) C# – Value Types and Reference Types Panel 1 Panel 2 Value Types Value Type Point is a Struct By Value (copy) Point p1 = new Point(); Point p2 = p1; int, float, … , Point, Vector2 (structs) (p2 is a copy of p1) Reference Types By Reference (reference) Reference Type Classes Person is a Class Person p1 = new Person(); Person(); Person p2 = p1; (p2 points to the same object as p1) 3
  • 4. C# – Array & List Array (fixed size) int[] int[] myArray = new int[10]; int[10]; myArray[2] myArray[2] = 3; List (can grow) List<int> List<int> myList = new List<int>(); List<int>(); myList.Add(3); myList.Add(3); int myValue = myList[0]; myList[0]; C# – Iteration Standard for loop o for( t y st Cou tt; myList.Count; for(int i = 0; i < myList.Count; i++) { ) Console.WriteLine(myList[ Console.WriteLine(myList[i]); } foreach loop foreach( foreach(int value in myList) { myList) Console.WriteLine( l ) Console.WriteLine(value); C l W it Li (value); } 4
  • 5. C# – get/set methods Java Panel 1 ------------------------------------------------ class Person { private int age; public int getAge() { return age; } getAge() public void setAge(int value) { setAge( if(age if(age >= 0) age = value; } } ------------------------------------------------ Person p = new Person(); Person(); p.setAge(20); p.setAge(20); int age = p.getAge(); p.getAge(); C# – Properties C# Panel 1 Panel 2 ------------------------------------------------ class Person { private int age; public int Age { get { return age; } set { if(age if(age >= 0) age = value; value; } } } ------------------------------------------------ Person p = new Person(); Person(); p.Age = 20; int age = p.Age; p.Age; 5
  • 6. ACTION 6