SlideShare a Scribd company logo
Chapter 8C# .NET Arrays
Pascal caseAddUp(..)Camel casefirstNumberC Programming Language casefirst_numbera word on naming conventions
Why use Arrays?How to set up Array?Arrays and LoopsSet size of Arrays at runtimeForeach loopWhat will we learn?
The variables we have been working with so far have only been able to hold one value at a timeExample:int lotteryNumber1 = 1;int lotteryNumber2 = 2;int lotteryNumber3 = 3;   :An Array allows you to use just one identifying name that refers to lots of valuesWhy use Arrays?
1. Declaration:int[] lotteryNumbers;float[] myFloatValues;string[] myStrings;2. Size of array:lotteryNumbers = new int[4];myFloatValues = new float[10];myStrings = new string[5];How to setup an Array
Declaration and setting the size in one lineint[] lotteryNumbers = new int[4];float[] myFloatValues = new float[10];string[] myStrings = new string[5];
arrayName[position] = arrayValue;int[] lotteryNumbers = new int[4];lotteryNumbers[0] = 1;       // first arraylotteryNumbers[1] = 2;lotteryNumbers[2] = 3;lotteryNumbers[3] = 4;   // last (4th) arrayAssigning values
int[] lotteryNumbers = new int[4];lotteryNumbers[0] = 1;   lotteryNumbers[1] = 2;lotteryNumbers[2] = 3;lotteryNumbers[3] = 4; First index is ZERO
int[] lotteryNumbers = new int[4];lotteryNumbers[0] = 1;   lotteryNumbers[1] = 2;lotteryNumbers[2] = 3;lotteryNumbers[3] = 4; Last index is (SIZE -1)
int[] lotteryNumbers = new int[4];lotteryNumbers[0] = 1;   lotteryNumbers[1] = 2;lotteryNumbers[2] = 3;lotteryNumbers[3] = 4; Total number of array = SIZE
int[] lotteryNumbers = new int[4] {1, 2, 3, 4};Declare, Set Array Size and Assign Values in one lineDeclare
int[] lotteryNumbers = new int[4] {1, 2, 3, 4};Set Size of Array
int[] lotteryNumbers = new int[4] {1, 2, 3, 4};Assign values
To loop through the following array:lotteryNumbers[0] lotteryNumbers[1]lotteryNumbers[2] lotteryNumbers[3] for (inti = 0; i != lotteryNumbers.Length; i++){lotteryNumber[i]     ….. // not complete}Part 2 Arrays and Loops
for (inti = 0; i != lotteryNumbers.Length; i++){lotteryNumber[i]     ….. // not complete}starts from 0The first index is ZERO
for (inti = 0; i != lotteryNumbers.Length; i++){lotteryNumber[i]     ….. // not complete}Length is equal to the SIZE of arrayThe last index should be (Length – 1)
for (inti = 0; i != lotteryNumbers.Length; i++){lotteryNumber[i]     ….. // not complete}i < lotteryNumers.Length
for (inti = 0; i != lotteryNumbers.Length; i++){lotteryNumber[i]     ….. // not complete}i <= lotteryNumers.Length -1
New Solution and project:  SpfChapter8Save allChange the project name to "Part 2 Arrays and Loops"Add a button and a listBoxAdd codes into the button click method:Hands On
Use Loop
C# Arrays
Use Loop
C# Arrays
C# Arrays
4
change the size of Array to 49:
Looping through from 2nd Array to last Arrayint() lotteryNumbers = int(5);for (inti=2; i != lotteryNumbers.Length; ++i){lotteryNumbers(i) = 0;} Spots the Errors
Why use Arrays?How to set up Array?Arrays and LoopsReview
Set size of Arrays at runtimeForeach loopWhat will we learn?
The size of an array refers to how many items it holdsBut sometimes, you just don’t know how big the array needs to be – for example, when the application depends on user’s input during runtimePart 3 Set the Size of a C# array at RunTime
Add another button and textboxContinue from previous project
Add codes for button2 Click method:
The size of the array is set only during runtime
Compare for loop and foreach loop:for (int i = 0; i != arraySize.Length; i++)foreach (int number in arraySize)foreach loop
Compare for loop and foreach loop:for (int i = 0; i != arraySize.Length; i++)foreach (int number in arraySize)foreach looploop through from 0 to (Length-1) counter
Compare for loop and foreach loop:for (int i = 0; i != arraySize.Length; i++)foreach (int number in arraySize)foreach looploop through from 0 to (Length-1) counterindividual element in array
Compare for loop and foreach loop:for (int i = 0; i != arraySize.Length; i++)foreach (int number in arraySize)foreach loopIndividual element: arraySize[i]Individual element: number
Continue from previous project (Extra)
string Array is similar to integer Array    string[] arrayStrings;arrayStrings = new string[5];foreach loop for stringforeach (string arrayElement in arrayStrings)Using foreach with string Array
Continue from previous project
string array using for loop
C# Arrays
string array using foreach

More Related Content

What's hot (20)

Arrays C#
Arrays C#Arrays C#
Arrays C#
Raghuveer Guthikonda
 
Networking in Java
Networking in JavaNetworking in Java
Networking in Java
Tushar B Kute
 
for loop in java
for loop in java for loop in java
for loop in java
Majid Ali
 
C# Exceptions Handling
C# Exceptions Handling C# Exceptions Handling
C# Exceptions Handling
sharqiyem
 
Python for loop
Python for loopPython for loop
Python for loop
Aishwarya Deshmukh
 
String and string buffer
String and string bufferString and string buffer
String and string buffer
kamal kotecha
 
Constructor in java
Constructor in javaConstructor in java
Constructor in java
Pavith Gunasekara
 
Database connectivity in python
Database connectivity in pythonDatabase connectivity in python
Database connectivity in python
baabtra.com - No. 1 supplier of quality freshers
 
Java - Collections framework
Java - Collections frameworkJava - Collections framework
Java - Collections framework
Riccardo Cardin
 
Classes, objects in JAVA
Classes, objects in JAVAClasses, objects in JAVA
Classes, objects in JAVA
Abhilash Nair
 
Collection Framework in java
Collection Framework in javaCollection Framework in java
Collection Framework in java
CPD INDIA
 
String.ppt
String.pptString.ppt
String.ppt
ajeela mushtaq
 
C# basics
 C# basics C# basics
C# basics
Dinesh kumar
 
JAVA AWT
JAVA AWTJAVA AWT
JAVA AWT
shanmuga rajan
 
Union in C programming
Union in C programmingUnion in C programming
Union in C programming
Kamal Acharya
 
Constraints In Sql
Constraints In SqlConstraints In Sql
Constraints In Sql
Anurag
 
Servlets
ServletsServlets
Servlets
ZainabNoorGul
 
Java Servlets
Java ServletsJava Servlets
Java Servlets
BG Java EE Course
 
Sql subquery
Sql  subquerySql  subquery
Sql subquery
Raveena Thakur
 
JavaScript - Chapter 12 - Document Object Model
  JavaScript - Chapter 12 - Document Object Model  JavaScript - Chapter 12 - Document Object Model
JavaScript - Chapter 12 - Document Object Model
WebStackAcademy
 

Viewers also liked (20)

Arrays
ArraysArrays
Arrays
archikabhatia
 
Lecture17 arrays.ppt
Lecture17 arrays.pptLecture17 arrays.ppt
Lecture17 arrays.ppt
eShikshak
 
Array in C# 3.5
Array in C# 3.5Array in C# 3.5
Array in C# 3.5
Gopal Ji Singh
 
Array in c language
Array in c languageArray in c language
Array in c language
home
 
Arrays In General
Arrays In GeneralArrays In General
Arrays In General
martha leon
 
Lecture 2c stacks
Lecture 2c stacksLecture 2c stacks
Lecture 2c stacks
Victor Palmar
 
Lecture 3 data structures & algorithms - sorting techniques - http://techiem...
Lecture 3  data structures & algorithms - sorting techniques - http://techiem...Lecture 3  data structures & algorithms - sorting techniques - http://techiem...
Lecture 3 data structures & algorithms - sorting techniques - http://techiem...
Dharmendra Prasad
 
Array y Objects C#
Array y Objects C#Array y Objects C#
Array y Objects C#
Manuel Antonio
 
Lecture 2 data structures & algorithms - sorting techniques
Lecture 2  data structures & algorithms - sorting techniquesLecture 2  data structures & algorithms - sorting techniques
Lecture 2 data structures & algorithms - sorting techniques
Dharmendra Prasad
 
Pascal
PascalPascal
Pascal
Ezeodum Austin
 
Arrays
ArraysArrays
Arrays
Trupti Agrawal
 
Csc153 chapter 06
Csc153 chapter 06Csc153 chapter 06
Csc153 chapter 06
PCC
 
C++ arrays part2
C++ arrays part2C++ arrays part2
C++ arrays part2
Subhasis Nayak
 
Arrays
ArraysArrays
Arrays
Peter Andrews
 
Lecture 2a arrays
Lecture 2a arraysLecture 2a arrays
Lecture 2a arrays
Victor Palmar
 
Learning VB.NET Programming Concepts
Learning VB.NET Programming ConceptsLearning VB.NET Programming Concepts
Learning VB.NET Programming Concepts
guest25d6e3
 
queue & its applications
queue & its applicationsqueue & its applications
queue & its applications
somendra kumar
 
C
CC
C
prem steephen
 
Arrays Class presentation
Arrays Class presentationArrays Class presentation
Arrays Class presentation
Neveen Reda
 
Sorting
SortingSorting
Sorting
Ghaffar Khan
 
Lecture17 arrays.ppt
Lecture17 arrays.pptLecture17 arrays.ppt
Lecture17 arrays.ppt
eShikshak
 
Array in c language
Array in c languageArray in c language
Array in c language
home
 
Arrays In General
Arrays In GeneralArrays In General
Arrays In General
martha leon
 
Lecture 3 data structures & algorithms - sorting techniques - http://techiem...
Lecture 3  data structures & algorithms - sorting techniques - http://techiem...Lecture 3  data structures & algorithms - sorting techniques - http://techiem...
Lecture 3 data structures & algorithms - sorting techniques - http://techiem...
Dharmendra Prasad
 
Lecture 2 data structures & algorithms - sorting techniques
Lecture 2  data structures & algorithms - sorting techniquesLecture 2  data structures & algorithms - sorting techniques
Lecture 2 data structures & algorithms - sorting techniques
Dharmendra Prasad
 
Csc153 chapter 06
Csc153 chapter 06Csc153 chapter 06
Csc153 chapter 06
PCC
 
Learning VB.NET Programming Concepts
Learning VB.NET Programming ConceptsLearning VB.NET Programming Concepts
Learning VB.NET Programming Concepts
guest25d6e3
 
queue & its applications
queue & its applicationsqueue & its applications
queue & its applications
somendra kumar
 
Arrays Class presentation
Arrays Class presentationArrays Class presentation
Arrays Class presentation
Neveen Reda
 
Ad

Similar to C# Arrays (20)

spfchapter8arrays-100519221515-phpapp01.pdf
spfchapter8arrays-100519221515-phpapp01.pdfspfchapter8arrays-100519221515-phpapp01.pdf
spfchapter8arrays-100519221515-phpapp01.pdf
pepe3059
 
arrays-120712074248-phpapp01
arrays-120712074248-phpapp01arrays-120712074248-phpapp01
arrays-120712074248-phpapp01
Abdul Samee
 
Loops in C# for loops while and do while loop.
Loops in C# for loops while and do while loop.Loops in C# for loops while and do while loop.
Loops in C# for loops while and do while loop.
Abid Kohistani
 
Visual Programing basic lectures 7.pptx
Visual Programing basic lectures  7.pptxVisual Programing basic lectures  7.pptx
Visual Programing basic lectures 7.pptx
Mrhaider4
 
C# Tutorial MSM_Murach chapter-08-slides
C# Tutorial MSM_Murach chapter-08-slidesC# Tutorial MSM_Murach chapter-08-slides
C# Tutorial MSM_Murach chapter-08-slides
Sami Mut
 
C sharp chap6
C sharp chap6C sharp chap6
C sharp chap6
Mukesh Tekwani
 
C# basics
C# basicsC# basics
C# basics
sagaroceanic11
 
Chapter 2
Chapter 2Chapter 2
Chapter 2
application developer
 
07 Arrays
07 Arrays07 Arrays
07 Arrays
maznabili
 
Csphtp1 07
Csphtp1 07Csphtp1 07
Csphtp1 07
HUST
 
arrays in c# including Classes handling arrays
arrays in c#  including Classes handling arraysarrays in c#  including Classes handling arrays
arrays in c# including Classes handling arrays
JayanthiM19
 
Intro to C# - part 2.pptx emerging technology
Intro to C# - part 2.pptx emerging technologyIntro to C# - part 2.pptx emerging technology
Intro to C# - part 2.pptx emerging technology
worldchannel
 
16. Arrays Lists Stacks Queues
16. Arrays Lists Stacks Queues16. Arrays Lists Stacks Queues
16. Arrays Lists Stacks Queues
Intro C# Book
 
Oops pramming with examples
Oops pramming with examplesOops pramming with examples
Oops pramming with examples
Syed Khaleel
 
C# p9
C# p9C# p9
C# p9
Renas Rekany
 
Strings Arrays
Strings ArraysStrings Arrays
Strings Arrays
phanleson
 
Mesics lecture 8 arrays in 'c'
Mesics lecture 8   arrays in 'c'Mesics lecture 8   arrays in 'c'
Mesics lecture 8 arrays in 'c'
eShikshak
 
For Beginners - C#
For Beginners - C#For Beginners - C#
For Beginners - C#
Snehal Harawande
 
07. Arrays
07. Arrays07. Arrays
07. Arrays
Intro C# Book
 
Session#2
Session#2Session#2
Session#2
Mohamed Samir
 
spfchapter8arrays-100519221515-phpapp01.pdf
spfchapter8arrays-100519221515-phpapp01.pdfspfchapter8arrays-100519221515-phpapp01.pdf
spfchapter8arrays-100519221515-phpapp01.pdf
pepe3059
 
arrays-120712074248-phpapp01
arrays-120712074248-phpapp01arrays-120712074248-phpapp01
arrays-120712074248-phpapp01
Abdul Samee
 
Loops in C# for loops while and do while loop.
Loops in C# for loops while and do while loop.Loops in C# for loops while and do while loop.
Loops in C# for loops while and do while loop.
Abid Kohistani
 
Visual Programing basic lectures 7.pptx
Visual Programing basic lectures  7.pptxVisual Programing basic lectures  7.pptx
Visual Programing basic lectures 7.pptx
Mrhaider4
 
C# Tutorial MSM_Murach chapter-08-slides
C# Tutorial MSM_Murach chapter-08-slidesC# Tutorial MSM_Murach chapter-08-slides
C# Tutorial MSM_Murach chapter-08-slides
Sami Mut
 
Csphtp1 07
Csphtp1 07Csphtp1 07
Csphtp1 07
HUST
 
arrays in c# including Classes handling arrays
arrays in c#  including Classes handling arraysarrays in c#  including Classes handling arrays
arrays in c# including Classes handling arrays
JayanthiM19
 
Intro to C# - part 2.pptx emerging technology
Intro to C# - part 2.pptx emerging technologyIntro to C# - part 2.pptx emerging technology
Intro to C# - part 2.pptx emerging technology
worldchannel
 
16. Arrays Lists Stacks Queues
16. Arrays Lists Stacks Queues16. Arrays Lists Stacks Queues
16. Arrays Lists Stacks Queues
Intro C# Book
 
Oops pramming with examples
Oops pramming with examplesOops pramming with examples
Oops pramming with examples
Syed Khaleel
 
Strings Arrays
Strings ArraysStrings Arrays
Strings Arrays
phanleson
 
Mesics lecture 8 arrays in 'c'
Mesics lecture 8   arrays in 'c'Mesics lecture 8   arrays in 'c'
Mesics lecture 8 arrays in 'c'
eShikshak
 
Ad

More from Hock Leng PUAH (20)

ASP.net Image Slideshow
ASP.net Image SlideshowASP.net Image Slideshow
ASP.net Image Slideshow
Hock Leng PUAH
 
Visual basic asp.net programming introduction
Visual basic asp.net programming introductionVisual basic asp.net programming introduction
Visual basic asp.net programming introduction
Hock Leng PUAH
 
Using iMac Built-in Screen Sharing
Using iMac Built-in Screen SharingUsing iMac Built-in Screen Sharing
Using iMac Built-in Screen Sharing
Hock Leng PUAH
 
Hosting SWF Flash file
Hosting SWF Flash fileHosting SWF Flash file
Hosting SWF Flash file
Hock Leng PUAH
 
PHP built-in functions date( ) and mktime( ) to calculate age from date of birth
PHP built-in functions date( ) and mktime( ) to calculate age from date of birthPHP built-in functions date( ) and mktime( ) to calculate age from date of birth
PHP built-in functions date( ) and mktime( ) to calculate age from date of birth
Hock Leng PUAH
 
PHP built-in function mktime example
PHP built-in function mktime examplePHP built-in function mktime example
PHP built-in function mktime example
Hock Leng PUAH
 
A simple php exercise on date( ) function
A simple php exercise on date( ) functionA simple php exercise on date( ) function
A simple php exercise on date( ) function
Hock Leng PUAH
 
Integrate jQuery PHP MySQL project to JOOMLA web site
Integrate jQuery PHP MySQL project to JOOMLA web siteIntegrate jQuery PHP MySQL project to JOOMLA web site
Integrate jQuery PHP MySQL project to JOOMLA web site
Hock Leng PUAH
 
Responsive design
Responsive designResponsive design
Responsive design
Hock Leng PUAH
 
Step by step guide to use mac lion to make hidden folders visible
Step by step guide to use mac lion to make hidden folders visibleStep by step guide to use mac lion to make hidden folders visible
Step by step guide to use mac lion to make hidden folders visible
Hock Leng PUAH
 
Beautiful web pages
Beautiful web pagesBeautiful web pages
Beautiful web pages
Hock Leng PUAH
 
CSS Basic and Common Errors
CSS Basic and Common ErrorsCSS Basic and Common Errors
CSS Basic and Common Errors
Hock Leng PUAH
 
Connectivity Test for EES Logic Probe Project
Connectivity Test for EES Logic Probe ProjectConnectivity Test for EES Logic Probe Project
Connectivity Test for EES Logic Probe Project
Hock Leng PUAH
 
Logic gate lab intro
Logic gate lab introLogic gate lab intro
Logic gate lab intro
Hock Leng PUAH
 
Ohm's law, resistors in series or in parallel
Ohm's law, resistors in series or in parallelOhm's law, resistors in series or in parallel
Ohm's law, resistors in series or in parallel
Hock Leng PUAH
 
Connections Exercises Guide
Connections Exercises GuideConnections Exercises Guide
Connections Exercises Guide
Hock Leng PUAH
 
Design to circuit connection
Design to circuit connectionDesign to circuit connection
Design to circuit connection
Hock Leng PUAH
 
NMS Media Services Jobshet 1 to 5 Summary
NMS Media Services Jobshet 1 to 5 SummaryNMS Media Services Jobshet 1 to 5 Summary
NMS Media Services Jobshet 1 to 5 Summary
Hock Leng PUAH
 
Virtualbox step by step guide
Virtualbox step by step guideVirtualbox step by step guide
Virtualbox step by step guide
Hock Leng PUAH
 
Nms chapter 01
Nms chapter 01Nms chapter 01
Nms chapter 01
Hock Leng PUAH
 
ASP.net Image Slideshow
ASP.net Image SlideshowASP.net Image Slideshow
ASP.net Image Slideshow
Hock Leng PUAH
 
Visual basic asp.net programming introduction
Visual basic asp.net programming introductionVisual basic asp.net programming introduction
Visual basic asp.net programming introduction
Hock Leng PUAH
 
Using iMac Built-in Screen Sharing
Using iMac Built-in Screen SharingUsing iMac Built-in Screen Sharing
Using iMac Built-in Screen Sharing
Hock Leng PUAH
 
Hosting SWF Flash file
Hosting SWF Flash fileHosting SWF Flash file
Hosting SWF Flash file
Hock Leng PUAH
 
PHP built-in functions date( ) and mktime( ) to calculate age from date of birth
PHP built-in functions date( ) and mktime( ) to calculate age from date of birthPHP built-in functions date( ) and mktime( ) to calculate age from date of birth
PHP built-in functions date( ) and mktime( ) to calculate age from date of birth
Hock Leng PUAH
 
PHP built-in function mktime example
PHP built-in function mktime examplePHP built-in function mktime example
PHP built-in function mktime example
Hock Leng PUAH
 
A simple php exercise on date( ) function
A simple php exercise on date( ) functionA simple php exercise on date( ) function
A simple php exercise on date( ) function
Hock Leng PUAH
 
Integrate jQuery PHP MySQL project to JOOMLA web site
Integrate jQuery PHP MySQL project to JOOMLA web siteIntegrate jQuery PHP MySQL project to JOOMLA web site
Integrate jQuery PHP MySQL project to JOOMLA web site
Hock Leng PUAH
 
Step by step guide to use mac lion to make hidden folders visible
Step by step guide to use mac lion to make hidden folders visibleStep by step guide to use mac lion to make hidden folders visible
Step by step guide to use mac lion to make hidden folders visible
Hock Leng PUAH
 
CSS Basic and Common Errors
CSS Basic and Common ErrorsCSS Basic and Common Errors
CSS Basic and Common Errors
Hock Leng PUAH
 
Connectivity Test for EES Logic Probe Project
Connectivity Test for EES Logic Probe ProjectConnectivity Test for EES Logic Probe Project
Connectivity Test for EES Logic Probe Project
Hock Leng PUAH
 
Ohm's law, resistors in series or in parallel
Ohm's law, resistors in series or in parallelOhm's law, resistors in series or in parallel
Ohm's law, resistors in series or in parallel
Hock Leng PUAH
 
Connections Exercises Guide
Connections Exercises GuideConnections Exercises Guide
Connections Exercises Guide
Hock Leng PUAH
 
Design to circuit connection
Design to circuit connectionDesign to circuit connection
Design to circuit connection
Hock Leng PUAH
 
NMS Media Services Jobshet 1 to 5 Summary
NMS Media Services Jobshet 1 to 5 SummaryNMS Media Services Jobshet 1 to 5 Summary
NMS Media Services Jobshet 1 to 5 Summary
Hock Leng PUAH
 
Virtualbox step by step guide
Virtualbox step by step guideVirtualbox step by step guide
Virtualbox step by step guide
Hock Leng PUAH
 

Recently uploaded (20)

How to Setup Lunch in Odoo 18 - Odoo guides
How to Setup Lunch in Odoo 18 - Odoo guidesHow to Setup Lunch in Odoo 18 - Odoo guides
How to Setup Lunch in Odoo 18 - Odoo guides
Celine George
 
QUIZ-O-FORCE FINAL SET BY SUDIPTA & SUBHAM.pptx
QUIZ-O-FORCE FINAL SET BY SUDIPTA & SUBHAM.pptxQUIZ-O-FORCE FINAL SET BY SUDIPTA & SUBHAM.pptx
QUIZ-O-FORCE FINAL SET BY SUDIPTA & SUBHAM.pptx
Sourav Kr Podder
 
Stewart Butler - OECD - How to design and deliver higher technical education ...
Stewart Butler - OECD - How to design and deliver higher technical education ...Stewart Butler - OECD - How to design and deliver higher technical education ...
Stewart Butler - OECD - How to design and deliver higher technical education ...
EduSkills OECD
 
LDMMIA About me 2025 Edition 3 College Volume
LDMMIA About me 2025 Edition 3 College VolumeLDMMIA About me 2025 Edition 3 College Volume
LDMMIA About me 2025 Edition 3 College Volume
LDM & Mia eStudios
 
Dashboard Overview in Odoo 18 - Odoo Slides
Dashboard Overview in Odoo 18 - Odoo SlidesDashboard Overview in Odoo 18 - Odoo Slides
Dashboard Overview in Odoo 18 - Odoo Slides
Celine George
 
Search Engine Optimization (SEO) for Website Success
Search Engine Optimization (SEO) for Website SuccessSearch Engine Optimization (SEO) for Website Success
Search Engine Optimization (SEO) for Website Success
Muneeb Rana
 
How to Manage Orders in Odoo 18 Lunch - Odoo Slides
How to Manage Orders in Odoo 18 Lunch - Odoo SlidesHow to Manage Orders in Odoo 18 Lunch - Odoo Slides
How to Manage Orders in Odoo 18 Lunch - Odoo Slides
Celine George
 
Writing Research Papers: Guidance for Research Community
Writing Research Papers: Guidance for Research CommunityWriting Research Papers: Guidance for Research Community
Writing Research Papers: Guidance for Research Community
Rishi Bankim Chandra Evening College, Naihati, North 24 Parganas, West Bengal, India
 
How to Use Owl Slots in Odoo 17 - Odoo Slides
How to Use Owl Slots in Odoo 17 - Odoo SlidesHow to Use Owl Slots in Odoo 17 - Odoo Slides
How to Use Owl Slots in Odoo 17 - Odoo Slides
Celine George
 
THE CHURCH AND ITS IMPACT: FOSTERING CHRISTIAN EDUCATION
THE CHURCH AND ITS IMPACT: FOSTERING CHRISTIAN EDUCATIONTHE CHURCH AND ITS IMPACT: FOSTERING CHRISTIAN EDUCATION
THE CHURCH AND ITS IMPACT: FOSTERING CHRISTIAN EDUCATION
PROF. PAUL ALLIEU KAMARA
 
Order: Odonata Isoptera and Thysanoptera.pptx
Order: Odonata Isoptera and Thysanoptera.pptxOrder: Odonata Isoptera and Thysanoptera.pptx
Order: Odonata Isoptera and Thysanoptera.pptx
Arshad Shaikh
 
LET´S PRACTICE GRAMMAR USING SIMPLE PAST TENSE
LET´S PRACTICE GRAMMAR USING SIMPLE PAST TENSELET´S PRACTICE GRAMMAR USING SIMPLE PAST TENSE
LET´S PRACTICE GRAMMAR USING SIMPLE PAST TENSE
OlgaLeonorTorresSnch
 
CBSE - Grade 11 - Mathematics - Ch 2 - Relations And Functions - Notes (PDF F...
CBSE - Grade 11 - Mathematics - Ch 2 - Relations And Functions - Notes (PDF F...CBSE - Grade 11 - Mathematics - Ch 2 - Relations And Functions - Notes (PDF F...
CBSE - Grade 11 - Mathematics - Ch 2 - Relations And Functions - Notes (PDF F...
Sritoma Majumder
 
How to Setup Renewal of Subscription in Odoo 18
How to Setup Renewal of Subscription in Odoo 18How to Setup Renewal of Subscription in Odoo 18
How to Setup Renewal of Subscription in Odoo 18
Celine George
 
"Orthoptera: Grasshoppers, Crickets, and Katydids pptx
"Orthoptera: Grasshoppers, Crickets, and Katydids pptx"Orthoptera: Grasshoppers, Crickets, and Katydids pptx
"Orthoptera: Grasshoppers, Crickets, and Katydids pptx
Arshad Shaikh
 
How to Create Time Off Request in Odoo 18 Time Off
How to Create Time Off Request in Odoo 18 Time OffHow to Create Time Off Request in Odoo 18 Time Off
How to Create Time Off Request in Odoo 18 Time Off
Celine George
 
POS Reporting in Odoo 18 - Odoo 18 Slides
POS Reporting in Odoo 18 - Odoo 18 SlidesPOS Reporting in Odoo 18 - Odoo 18 Slides
POS Reporting in Odoo 18 - Odoo 18 Slides
Celine George
 
SEM II 3202 STRUCTURAL MECHANICS, B ARCH, REGULATION 2021, ANNA UNIVERSITY, R...
SEM II 3202 STRUCTURAL MECHANICS, B ARCH, REGULATION 2021, ANNA UNIVERSITY, R...SEM II 3202 STRUCTURAL MECHANICS, B ARCH, REGULATION 2021, ANNA UNIVERSITY, R...
SEM II 3202 STRUCTURAL MECHANICS, B ARCH, REGULATION 2021, ANNA UNIVERSITY, R...
RVSPSOA
 
Forestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdf
Forestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdfForestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdf
Forestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdf
ChalaKelbessa
 
Critical Thinking and Bias with Jibi Moses
Critical Thinking and Bias with Jibi MosesCritical Thinking and Bias with Jibi Moses
Critical Thinking and Bias with Jibi Moses
Excellence Foundation for South Sudan
 
How to Setup Lunch in Odoo 18 - Odoo guides
How to Setup Lunch in Odoo 18 - Odoo guidesHow to Setup Lunch in Odoo 18 - Odoo guides
How to Setup Lunch in Odoo 18 - Odoo guides
Celine George
 
QUIZ-O-FORCE FINAL SET BY SUDIPTA & SUBHAM.pptx
QUIZ-O-FORCE FINAL SET BY SUDIPTA & SUBHAM.pptxQUIZ-O-FORCE FINAL SET BY SUDIPTA & SUBHAM.pptx
QUIZ-O-FORCE FINAL SET BY SUDIPTA & SUBHAM.pptx
Sourav Kr Podder
 
Stewart Butler - OECD - How to design and deliver higher technical education ...
Stewart Butler - OECD - How to design and deliver higher technical education ...Stewart Butler - OECD - How to design and deliver higher technical education ...
Stewart Butler - OECD - How to design and deliver higher technical education ...
EduSkills OECD
 
LDMMIA About me 2025 Edition 3 College Volume
LDMMIA About me 2025 Edition 3 College VolumeLDMMIA About me 2025 Edition 3 College Volume
LDMMIA About me 2025 Edition 3 College Volume
LDM & Mia eStudios
 
Dashboard Overview in Odoo 18 - Odoo Slides
Dashboard Overview in Odoo 18 - Odoo SlidesDashboard Overview in Odoo 18 - Odoo Slides
Dashboard Overview in Odoo 18 - Odoo Slides
Celine George
 
Search Engine Optimization (SEO) for Website Success
Search Engine Optimization (SEO) for Website SuccessSearch Engine Optimization (SEO) for Website Success
Search Engine Optimization (SEO) for Website Success
Muneeb Rana
 
How to Manage Orders in Odoo 18 Lunch - Odoo Slides
How to Manage Orders in Odoo 18 Lunch - Odoo SlidesHow to Manage Orders in Odoo 18 Lunch - Odoo Slides
How to Manage Orders in Odoo 18 Lunch - Odoo Slides
Celine George
 
How to Use Owl Slots in Odoo 17 - Odoo Slides
How to Use Owl Slots in Odoo 17 - Odoo SlidesHow to Use Owl Slots in Odoo 17 - Odoo Slides
How to Use Owl Slots in Odoo 17 - Odoo Slides
Celine George
 
THE CHURCH AND ITS IMPACT: FOSTERING CHRISTIAN EDUCATION
THE CHURCH AND ITS IMPACT: FOSTERING CHRISTIAN EDUCATIONTHE CHURCH AND ITS IMPACT: FOSTERING CHRISTIAN EDUCATION
THE CHURCH AND ITS IMPACT: FOSTERING CHRISTIAN EDUCATION
PROF. PAUL ALLIEU KAMARA
 
Order: Odonata Isoptera and Thysanoptera.pptx
Order: Odonata Isoptera and Thysanoptera.pptxOrder: Odonata Isoptera and Thysanoptera.pptx
Order: Odonata Isoptera and Thysanoptera.pptx
Arshad Shaikh
 
LET´S PRACTICE GRAMMAR USING SIMPLE PAST TENSE
LET´S PRACTICE GRAMMAR USING SIMPLE PAST TENSELET´S PRACTICE GRAMMAR USING SIMPLE PAST TENSE
LET´S PRACTICE GRAMMAR USING SIMPLE PAST TENSE
OlgaLeonorTorresSnch
 
CBSE - Grade 11 - Mathematics - Ch 2 - Relations And Functions - Notes (PDF F...
CBSE - Grade 11 - Mathematics - Ch 2 - Relations And Functions - Notes (PDF F...CBSE - Grade 11 - Mathematics - Ch 2 - Relations And Functions - Notes (PDF F...
CBSE - Grade 11 - Mathematics - Ch 2 - Relations And Functions - Notes (PDF F...
Sritoma Majumder
 
How to Setup Renewal of Subscription in Odoo 18
How to Setup Renewal of Subscription in Odoo 18How to Setup Renewal of Subscription in Odoo 18
How to Setup Renewal of Subscription in Odoo 18
Celine George
 
"Orthoptera: Grasshoppers, Crickets, and Katydids pptx
"Orthoptera: Grasshoppers, Crickets, and Katydids pptx"Orthoptera: Grasshoppers, Crickets, and Katydids pptx
"Orthoptera: Grasshoppers, Crickets, and Katydids pptx
Arshad Shaikh
 
How to Create Time Off Request in Odoo 18 Time Off
How to Create Time Off Request in Odoo 18 Time OffHow to Create Time Off Request in Odoo 18 Time Off
How to Create Time Off Request in Odoo 18 Time Off
Celine George
 
POS Reporting in Odoo 18 - Odoo 18 Slides
POS Reporting in Odoo 18 - Odoo 18 SlidesPOS Reporting in Odoo 18 - Odoo 18 Slides
POS Reporting in Odoo 18 - Odoo 18 Slides
Celine George
 
SEM II 3202 STRUCTURAL MECHANICS, B ARCH, REGULATION 2021, ANNA UNIVERSITY, R...
SEM II 3202 STRUCTURAL MECHANICS, B ARCH, REGULATION 2021, ANNA UNIVERSITY, R...SEM II 3202 STRUCTURAL MECHANICS, B ARCH, REGULATION 2021, ANNA UNIVERSITY, R...
SEM II 3202 STRUCTURAL MECHANICS, B ARCH, REGULATION 2021, ANNA UNIVERSITY, R...
RVSPSOA
 
Forestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdf
Forestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdfForestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdf
Forestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdf
ChalaKelbessa
 

C# Arrays

  • 2. Pascal caseAddUp(..)Camel casefirstNumberC Programming Language casefirst_numbera word on naming conventions
  • 3. Why use Arrays?How to set up Array?Arrays and LoopsSet size of Arrays at runtimeForeach loopWhat will we learn?
  • 4. The variables we have been working with so far have only been able to hold one value at a timeExample:int lotteryNumber1 = 1;int lotteryNumber2 = 2;int lotteryNumber3 = 3; :An Array allows you to use just one identifying name that refers to lots of valuesWhy use Arrays?
  • 5. 1. Declaration:int[] lotteryNumbers;float[] myFloatValues;string[] myStrings;2. Size of array:lotteryNumbers = new int[4];myFloatValues = new float[10];myStrings = new string[5];How to setup an Array
  • 6. Declaration and setting the size in one lineint[] lotteryNumbers = new int[4];float[] myFloatValues = new float[10];string[] myStrings = new string[5];
  • 7. arrayName[position] = arrayValue;int[] lotteryNumbers = new int[4];lotteryNumbers[0] = 1; // first arraylotteryNumbers[1] = 2;lotteryNumbers[2] = 3;lotteryNumbers[3] = 4; // last (4th) arrayAssigning values
  • 8. int[] lotteryNumbers = new int[4];lotteryNumbers[0] = 1; lotteryNumbers[1] = 2;lotteryNumbers[2] = 3;lotteryNumbers[3] = 4; First index is ZERO
  • 9. int[] lotteryNumbers = new int[4];lotteryNumbers[0] = 1; lotteryNumbers[1] = 2;lotteryNumbers[2] = 3;lotteryNumbers[3] = 4; Last index is (SIZE -1)
  • 10. int[] lotteryNumbers = new int[4];lotteryNumbers[0] = 1; lotteryNumbers[1] = 2;lotteryNumbers[2] = 3;lotteryNumbers[3] = 4; Total number of array = SIZE
  • 11. int[] lotteryNumbers = new int[4] {1, 2, 3, 4};Declare, Set Array Size and Assign Values in one lineDeclare
  • 12. int[] lotteryNumbers = new int[4] {1, 2, 3, 4};Set Size of Array
  • 13. int[] lotteryNumbers = new int[4] {1, 2, 3, 4};Assign values
  • 14. To loop through the following array:lotteryNumbers[0] lotteryNumbers[1]lotteryNumbers[2] lotteryNumbers[3] for (inti = 0; i != lotteryNumbers.Length; i++){lotteryNumber[i] ….. // not complete}Part 2 Arrays and Loops
  • 15. for (inti = 0; i != lotteryNumbers.Length; i++){lotteryNumber[i] ….. // not complete}starts from 0The first index is ZERO
  • 16. for (inti = 0; i != lotteryNumbers.Length; i++){lotteryNumber[i] ….. // not complete}Length is equal to the SIZE of arrayThe last index should be (Length – 1)
  • 17. for (inti = 0; i != lotteryNumbers.Length; i++){lotteryNumber[i] ….. // not complete}i < lotteryNumers.Length
  • 18. for (inti = 0; i != lotteryNumbers.Length; i++){lotteryNumber[i] ….. // not complete}i <= lotteryNumers.Length -1
  • 19. New Solution and project: SpfChapter8Save allChange the project name to "Part 2 Arrays and Loops"Add a button and a listBoxAdd codes into the button click method:Hands On
  • 25. 4
  • 26. change the size of Array to 49:
  • 27. Looping through from 2nd Array to last Arrayint() lotteryNumbers = int(5);for (inti=2; i != lotteryNumbers.Length; ++i){lotteryNumbers(i) = 0;} Spots the Errors
  • 28. Why use Arrays?How to set up Array?Arrays and LoopsReview
  • 29. Set size of Arrays at runtimeForeach loopWhat will we learn?
  • 30. The size of an array refers to how many items it holdsBut sometimes, you just don’t know how big the array needs to be – for example, when the application depends on user’s input during runtimePart 3 Set the Size of a C# array at RunTime
  • 31. Add another button and textboxContinue from previous project
  • 32. Add codes for button2 Click method:
  • 33. The size of the array is set only during runtime
  • 34. Compare for loop and foreach loop:for (int i = 0; i != arraySize.Length; i++)foreach (int number in arraySize)foreach loop
  • 35. Compare for loop and foreach loop:for (int i = 0; i != arraySize.Length; i++)foreach (int number in arraySize)foreach looploop through from 0 to (Length-1) counter
  • 36. Compare for loop and foreach loop:for (int i = 0; i != arraySize.Length; i++)foreach (int number in arraySize)foreach looploop through from 0 to (Length-1) counterindividual element in array
  • 37. Compare for loop and foreach loop:for (int i = 0; i != arraySize.Length; i++)foreach (int number in arraySize)foreach loopIndividual element: arraySize[i]Individual element: number
  • 38. Continue from previous project (Extra)
  • 39. string Array is similar to integer Array string[] arrayStrings;arrayStrings = new string[5];foreach loop for stringforeach (string arrayElement in arrayStrings)Using foreach with string Array