Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Batch25-polymorphism
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Comment

The student showed good understanding of the principle
2 changes: 2 additions & 0 deletions Batch25/Assignments/Polymorphism Assignment.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//Polymorphism Assignment
//Define a parent class with three methods. define another class, a child class to inherit the parent class. implement method overloading, overiding and hiding on each of the methods.
3 changes: 3 additions & 0 deletions Batch25/Comments/Comment.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Comment

The student showed good understanding of the principle
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added Batch25/LessonMaterials/List/.vs/List/v17/.suo
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"Version": 1,
"WorkspaceRootPath": "C:\\Users\\DADA\\Desktop\\List\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{2D8DC066-ADA7-4722-A4AD-270C2BE4C12C}|List.csproj|c:\\users\\dada\\desktop\\list\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{2D8DC066-ADA7-4722-A4AD-270C2BE4C12C}|List.csproj|solutionrelative:program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 0,
"Children": [
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "Program.cs",
"DocumentMoniker": "C:\\Users\\DADA\\Desktop\\List\\Program.cs",
"RelativeDocumentMoniker": "Program.cs",
"ToolTip": "C:\\Users\\DADA\\Desktop\\List\\Program.cs*",
"RelativeToolTip": "Program.cs*",
"ViewState": "AgIAAKoAAAAAAAAAAAAAALcAAAATAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-01-13T10:19:58.284Z",
"EditorCaption": ""
}
]
}
]
}
]
}
71 changes: 71 additions & 0 deletions Batch25/LessonMaterials/List/.vs/List/v17/DocumentLayout.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"Version": 1,
"WorkspaceRootPath": "C:\\Users\\DADA\\Desktop\\List\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{2D8DC066-ADA7-4722-A4AD-270C2BE4C12C}|List.csproj|c:\\users\\dada\\desktop\\list\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{2D8DC066-ADA7-4722-A4AD-270C2BE4C12C}|List.csproj|solutionrelative:program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{2D8DC066-ADA7-4722-A4AD-270C2BE4C12C}|List.csproj|c:\\users\\dada\\desktop\\list\\assesment.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{2D8DC066-ADA7-4722-A4AD-270C2BE4C12C}|List.csproj|solutionrelative:assesment.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{2D8DC066-ADA7-4722-A4AD-270C2BE4C12C}|List.csproj|c:\\users\\dada\\desktop\\list\\list.csproj||{FA3CD31E-987B-443A-9B81-186104E8DAC1}|",
"RelativeMoniker": "D:0:0:{2D8DC066-ADA7-4722-A4AD-270C2BE4C12C}|List.csproj|solutionrelative:list.csproj||{FA3CD31E-987B-443A-9B81-186104E8DAC1}|"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 2,
"Children": [
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "Assesment.cs",
"DocumentMoniker": "C:\\Users\\DADA\\Desktop\\List\\Assesment.cs",
"RelativeDocumentMoniker": "Assesment.cs",
"ToolTip": "C:\\Users\\DADA\\Desktop\\List\\Assesment.cs",
"RelativeToolTip": "Assesment.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-01-16T08:24:32.308Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 2,
"Title": "List",
"DocumentMoniker": "C:\\Users\\DADA\\Desktop\\List\\List.csproj",
"RelativeDocumentMoniker": "List.csproj",
"ToolTip": "C:\\Users\\DADA\\Desktop\\List\\List.csproj",
"RelativeToolTip": "List.csproj",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000758|",
"WhenOpened": "2025-01-16T08:24:02.307Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "Program.cs",
"DocumentMoniker": "C:\\Users\\DADA\\Desktop\\List\\Program.cs",
"RelativeDocumentMoniker": "Program.cs",
"ToolTip": "C:\\Users\\DADA\\Desktop\\List\\Program.cs",
"RelativeToolTip": "Program.cs",
"ViewState": "AgIAAH4AAAAAAAAAAAAAAAQAAABxAQAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-01-13T10:19:58.284Z",
"EditorCaption": ""
}
]
}
]
}
]
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
12 changes: 12 additions & 0 deletions Batch25/LessonMaterials/List/Assesment.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace List
{
internal class Assesment
{
}
}
10 changes: 10 additions & 0 deletions Batch25/LessonMaterials/List/List.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
22 changes: 22 additions & 0 deletions Batch25/LessonMaterials/List/List.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.12.35506.116 d17.12
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "List", "List.csproj", "{2D8DC066-ADA7-4722-A4AD-270C2BE4C12C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2D8DC066-ADA7-4722-A4AD-270C2BE4C12C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2D8DC066-ADA7-4722-A4AD-270C2BE4C12C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2D8DC066-ADA7-4722-A4AD-270C2BE4C12C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2D8DC066-ADA7-4722-A4AD-270C2BE4C12C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
199 changes: 199 additions & 0 deletions Batch25/LessonMaterials/List/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");

//What is Generic List<T> Collection in C#?
//The Generic List<T> in C# is a Collection Class that belongs to System.Collections.Generic namespace. This Generic List<T> Collection Class represents a strongly typed list of objects which can be accessed by using the integer index which is starting from 0. It also provides lots of methods that can be used for searching, sorting, and manipulating the list of items

//For example, Adding Elements using Add Method of the List Class. As you can see in the below code while creating the Generic List collection instance, we are specifying the type parameter as a string and this allows the collection to store elements of string type only. In this case, the element will be added at the end of the collection.

//List<T> variableName = new List<T>();

List<string> countries = new List<string>();

countries.Add("India");
countries.Add("Srilanka");
countries.Add("Nigeria");

// using object initializer

List<string> names = new List<string>
{
"Ade",
"Chuckwu",
"Danjuma"
};

/*Console.WriteLine(countries[0]);
Console.WriteLine(countries[1]);
Console.WriteLine(countries[2]);*/

//using foreach loop
/*foreach (string country in countries)
{
Console.WriteLine(country);
}*/

//using for loop
/*for (int i = 0; i < names.Count; i++)
{
Console.WriteLine(names[i]);
}*/

/*List<int> numbers = new List<int>();

numbers.Add(1);
numbers.Add(2);
numbers.Add(3);
numbers.Add(4);
numbers.Add(5);*/

/*List<int> numbers = new List<int>
{
1,
2,
3,
4,
5
};*/

List<int> numbers = new List<int> {1,2,3,4,5 };

/*Console.WriteLine(numbers[0]);
Console.WriteLine(numbers[1]);
Console.WriteLine(numbers[2]);*/

/*
foreach (int number in numbers)
{
Console.WriteLine(number);
}*/

/*for(int i = 0; i < numbers.Count; i++)
{
Console.WriteLine(numbers[i]);
}*/

//Creating Another Generic List Collection of String Type
/*string[] nations = { "Colombia", "Mexico", "Algeria" };

List<string> newCountries = new List<string>(nations);*/

List<string> newCountries = new List<string>();

//Adding Elements using Add Method
newCountries.Add("JAPAN");
newCountries.Add("UK");

//Adding the newCountries collection into countries collection using AddRange Method
countries.AddRange(newCountries);

Console.WriteLine($"the total number of countries is now {countries.Count}");

foreach(string country in countries)
{
Console.WriteLine(country);
}

//Insert(int index, T item): This method is used to insert an element into the Generic List at the specified index. Here, the parameter index specifies the zero-based index at which an item should be inserted and the parameter item specifies the object to insert. The value can be null for reference types. If the index is less than 0 or the index is greater than Generic List Count, then it will throw ArgumentOutOfRangeException.

//InsertRange(int index, IEnumerable<T> collection): This method is used to insert the elements of a collection into the Generic List at the specified index. Here, the parameter index specifies the zero-based index at which an item should be inserted. The parameter collection specifies the collection whose elements should be inserted into the Generic List. The collection itself cannot be null, but it can contain elements that are null if type T is a reference type. If the collection is null, then it will throw ArgumentNullException. If the index is less than 0 or the index is greater than Generic List Count, then it will throw ArgumentOutOfRangeEx

//inserting single element
/*List<string> states = new List<string> { "Lagos", "Abuja", "Port-Harcourt" };
Console.WriteLine($" The initial count is {states.Count}");

states.Insert(0, "Ogun");

Console.WriteLine($"The current count is {states.Count}");

for(int i = 0; i < states.Count; i++)
{
Console.WriteLine(states[i]);
}

//Adding multiple states
List<string> newstates = new List<string> { "Abia", "Bauchi", "Calabar" };

states.InsertRange(0, newstates);

Console.WriteLine($"After adding range of states, The current count is {states.Count}");

foreach(string state in states)
{
Console.WriteLine(state);
}*/

// How to Check the Availability of an Element in a List Collection in C#?
//If you want to check whether an element exists or not in the Generic List Collection, then you need to use the following Contains method of the Generic List Collection Class in C#.

//Contains(T item): The Contains(T item) method of the Generic List Collection Class is used to check if the given item is present in the List or not. The parameter item specifies the object to locate in the Generic List. The value can be null for reference types. It returns true if the item is found in the Generic List; otherwise, false.

/*List<int> nums = new List<int>();

nums.Add(1);
nums.Add(2);
nums.Add(3);
nums.Add(4);
nums.Add(5);

bool result = nums.Contains(1);
Console.WriteLine(result);

bool result1 = nums.Contains(6);
Console.WriteLine(result1);

bool result2 = nums.Contains(87);

if (result2 == true)
{
nums.Remove(5);
Console.WriteLine("The element has been removed successfully");
}
else
{
Console.WriteLine("The element does not exist in the collection");
}*/


// using RemoveAt
List<int> values = new List<int> { 2, 4, 5, 2, 6, 7, 2, 9, 0 };
values.RemoveAt(0); // specify the index of the element to be removed

//Using RemoveAll

//Remove all element 2

values.RemoveAll(x => x == 2);

for (int i = 0; i < values.Count; i++)
{
if (values[i] == 2)
{
values.Remove(values[i]);
}
}

foreach (int i in values)
{
Console.WriteLine(i);
}
values.Clear(); // Removes everthing int the collection

//Summary of Generic List<T> Collection Class in C#:
//The List<T> collection is different from the arrays. The List can be resized dynamically but arrays cannot resize dynamically.

//The Generic List<T> Collection Class in C# can accept null values for reference types and it also accepts duplicate values.

//When the element’s Count becomes equal to the Capacity of the list collection, then the capacity of the List increased automatically by reallocating the internal array. The existing elements will be copied to the new array before the addition of the new element.

//The Generic List class is the generic equivalent of the Non-Generic ArrayList class.

//The Generic List<T> class implements the IList<T> generic interface.

//We can use both equality and ordering comparer with the generic List class.

//The List<T> class elements are not sorted by default and elements are accessed by a zero-based index.

//For very large List<T> objects, you can increase the maximum capacity to 2 billion elements on a 64-bit system by setting the enabled attribute of the configuration element to true in the run-time environment.


23 changes: 23 additions & 0 deletions Batch25/LessonMaterials/List/bin/Debug/net8.0/List.deps.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v8.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v8.0": {
"List/1.0.0": {
"runtime": {
"List.dll": {}
}
}
}
},
"libraries": {
"List/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
}
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading