vault backup: 2023-11-23 09:48:36

This commit is contained in:
Louis Gallet 2023-11-23 09:48:36 +01:00
parent 6d4ca16577
commit 2ee026bf6f
Signed by: lgallet
SSH Key Fingerprint: SHA256:qnW7pk4EoMRR0UftZLZQKSMUImbEFsiruLC7jbCHJAY

View File

@ -1,3 +1,6 @@
<center><img src="https://i.imgur.com/UWw1g20.png" /></center>
## System Collections
We have 3 collections namespace in C#
- System.Collections
- Store items as Object
@ -13,4 +16,34 @@ We have 3 collections namespace in C#
- Dictionary<TKey,TValue>
- System.Collections.Concurrent
- As previous bu thread safe
-
## Live coding
```csharp
namespace Lecture;
public static class Program {
public static void Main() {
var myList = new List<int>();
myList.Add(12);
myList.Add(23);
myList.Add(122);
myList.Add(312);
myList.Add(142);
myList[4] = 1;
int a = myList[5];
Console.WriteLine($"{myList}"); // Will return the type of the list and the value
Console.WriteLine(a); // Will return the value a (myList[5])
foreach (var element in myList) {
Console.WriteLine($"{element}");
} // Will display each element of the list
myList.ForEach(x => Console.WriteLine($"{x}")); // Same thing that foreach bellow
var t = myList.GetRange(3, 2);
t.ForEach(x => Console.WriteLine($"{x}"));
myList.sort();
myList.
}
}