Florin Olariu: "Alexandru Ioan Cuza", University of Iași Department of Computer Science
Florin Olariu: "Alexandru Ioan Cuza", University of Iași Department of Computer Science
NET
Florin Olariu
“Alexandru Ioan Cuza”, University of Iași
Department of Computer Science
Agenda
Inheritance
OOP in .NET Core – inheritance
OOP in .NET Core - inheritance
OOP in .NET Core - polymorphism
Polymorphism
OOP in .NET Core - polymorphism
OOP in .NET Core - polymorphism
OOP in .NET Core - encapsulation
Encapsulation
OOP in .NET Core
"In the one and only true way. The object-oriented version of 'Spaghetti
code' is, of course, …."
OOP in .NET Core
"In the one and only true way. The object-oriented version of 'Spaghetti
code' is, of course, 'Lasagna code'."
- Roberto Waltman.
Arrays
Arrays
Definition
Samples
Declaring and populating an array
Using collection initializers
Retrieving an element from an array
Iterating an array
Using array methods
Best practices
Demo
Arrays
Definition
Arrays
Definition
Is a fixed-size list of elements that can be accessed using a positional index
number
Arrays
Definition
Is a fixed-size list of elements that can be accessed using a positional index
number
Sample:
Definition
Is a fixed-size list of elements that can be accessed using a positional index
number
Sample:
Definition
Samples
Declaring and populating an array
Arrays
Definition
Samples
Declaring and populating an array
Declaring an array:
Definition
Samples
Declaring and populating an array
Declaring an array: Initializing an array:
Red
string[] colors; string[] colors;
White
colors = new string[4];
Green
string[] colors = new string[4];
Blue
var colors = new string[4];
Arrays
Definition
Samples
Declaring and populating an array
Populating an array
Arrays
Definition
Samples
Declaring and populating an array
Populating an array
var colors = new string[4];
colors[0] = “Red”;
colors[1] = “White”;
colors[2] = “Green”;
colors[3] = “Blue”;
Arrays
Best practices
Do Avoid
Use arrays when the size is known at Do not use arrays when the data
the design time comes from a database call
For an array name use ‘pluralization’
=> Colors
Arrays
Demo
Generic List
Generic List
Definition
Arrays vs Generic List
Declaring and populating Generic Lists
Using initializers
Retrieving elements from Generic lists
Iterating through a Generic List
Demo
Generic List
Definition
It is a strongly typed list of elements that is accessed using a positional index
number.
Generic List
Demo
What’s next …
Generic dictionaries
Generic collection interfaces
LINQ
Interview questions
One more thing…