Тёмный

C# Lists 📃 

Bro Code
Подписаться 2,2 млн
Просмотров 104 тыс.
50% 1

C# lists tutorial example explained
#C# #list #tutorial
// List = data structure that represents a list of objects that can be accessed by index.
// Similar to array, but can dynamically increase/decrease in size
// using System.Collections.Generic;

Опубликовано:

 

30 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 99   
@BroCodez
@BroCodez 3 года назад
using System; using System.Collections.Generic; namespace MyFirstProgram { class Program { static void Main(string[] args) { // List = data structure that represents a list of objects that can be accessed by index. // Similar to array, but can dynamically increase/decrease in size // using System.Collections.Generic; List food = new List(); food.Add("pizza"); food.Add("hamburger"); food.Add("hotdog"); food.Add("fries"); //Console.WriteLine(food[0]); //Console.WriteLine(food[1]); //Console.WriteLine(food[2]); //Console.WriteLine(food[3]); //food.Remove("fries"); //food.Insert(0, "sushi"); //Console.WriteLine(food.Count); //Console.WriteLine(food.IndexOf("pizza")); //Console.WriteLine(food.LastIndexOf("fries")); //Console.WriteLine(food.Contains("pizza")); //food.Sort(); //food.Reverse(); //food.Clear(); //String[] foodArray = food.ToArray(); foreach (String item in food) { Console.WriteLine(item); } Console.ReadKey(); } } }
@vamshidharreddy3739
@vamshidharreddy3739 3 года назад
Never stop making vids bro plzzz keep going ❤️❤️❤️
@chrissauter7324
@chrissauter7324 Год назад
I am having some difficulty with being able to manually entering the items into my list through a loop. The problem is specifically the formatting of the 2 foreach loops (same problem with both, and problems with my new List equation foreach(String firearms in MyCollection[]) { Console.WriteLine(firearms); } (for this I am getting CS0443 -Syntax error, value expected/CS0030 - Cannot convert type 'char' to 'string' and CS0136 - A local or parameter named 'firearms cannot be declared in this scope because that name is used in enclosing local scope to define a local or parameter also have a problem with this statement - firearms = Console.ReadLine().ToString(MyCollection[]); Console.WriteLine(MyCollection[]);
@richardrackley2430
@richardrackley2430 Год назад
@@chrissauter7324 I know this is late but to address your issues: Just remove square brackets "[]" from all your code. You will only use this when references a numerical index for your list, similar to an array.
@maxwong1768
@maxwong1768 Год назад
Summarize : List is an advanced version of array with many useful methods but it consumes more memory than array . Method of list Declare a list List strList = new List(); // style 1 List strList = new(); // style 2 (quicker) Add/Insert/Remove an element Add an element strList.Add("a"); Insert an element strList.Insert(1, "b"); // 1 = index Remove an element strList.Remove("a"); Size of a list strList.Count() Index of a specific element First index strList.IndexOf("a"); Last index strList.LastIndexOf("a"); Check whether a list contains a specific element strList.Contains("a"); Sort the list Sort the list alphabetically strList.Sort(); Sort the list anti-alphabetically strList.Reverse(); Clear the list strList.Clear(); Switch between array and list Convert from array to list List strList = strArray.ToList(); // style 1 List strList = new(); strList.AddRange(strArray); // style 2 Convert from list to array String[] strArray = strList.ToArray(); If you want to print list for testing . static void Print(List strList) { foreach (String str in strList) { Console.Write(str); } Console.WriteLine(); } static void Print(List intList) // method overloading { foreach (int i in intList) { Console.Write(i); } Console.WriteLine(); }
@legelf
@legelf 10 месяцев назад
thanks man, i wish i had found this comment before because I just wanted to refresh my memory on lists and the video was kinda slow, this would've been sm faster 😂😂
@precious12
@precious12 6 месяцев назад
🥳
@Wall_Man_Studio_WMS
@Wall_Man_Studio_WMS 2 месяца назад
👍
@ShiftTGC
@ShiftTGC 2 года назад
I'm 90% sure I tried in the past to learn and understand Arrays and failed hard, even with friends trying to explain, and even tho this is a tutorial for lists, thank you for teaching me what I wanted to do with Arrays in less than a minute xD
@samdeur
@samdeur 2 года назад
Thank you bin looking at C# lists vid but yours is the first that is clear enough to me.. really helpful thanks..
@Mr-Eloda
@Mr-Eloda 2 года назад
Man you sure know how to make a good, quick and easy to understand video.
@sammaciel7835
@sammaciel7835 11 месяцев назад
Amazing tutorial. You have NO IDEA how much you helped me just now. Thanks so much!!! I have Lists sorted in my brain from now on. :)
@FHULUFHELONORMANMAMUSHIA-ng1up
ONE OF THE BEST TEACHERS OF COMPLEX THINGS 🤔🙌
@cride9858
@cride9858 3 года назад
best coding tutorial youtuber ngl
@syedmubazir4371
@syedmubazir4371 2 года назад
Watched your video and instantly subscribed! A great Content ❤️💯⭐
@huseyncfrov2514
@huseyncfrov2514 10 месяцев назад
"Those who stand at the top determine what's wrong and what's right! This very place is neutral ground! Justice will prevail, you say? But of course it will! Whoever wins this war becomes justice!" ~ Don Quixote Doflamingo
@Blane35
@Blane35 7 месяцев назад
How do I get the average value? I want to use the Variable.Average(); Command and then assign this average to another variable to display.
@gamingclipsrsa
@gamingclipsrsa 18 дней назад
Im writing an exam in 2 hours and i understand lists better than the 2 months in class. Thank you
@joshnjoshgaming
@joshnjoshgaming 2 года назад
very helpful and easy to understand :D
@ysawer
@ysawer 6 месяцев назад
this is a random commment AHHHHHHHHHHHH aHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@marrlowne5884
@marrlowne5884 2 года назад
Thanks! Everything very good explained
@nyeinchannyinyi19
@nyeinchannyinyi19 2 года назад
Nice tutorial Thanks
@Eh-man
@Eh-man 5 месяцев назад
Dude you're a life saver im not joking.
@akairibbon4658
@akairibbon4658 4 месяца назад
amazing video, great teaching man
3 года назад
Thanks Bro!
@LuzuVlogsGamer
@LuzuVlogsGamer Год назад
can we add custom Lists like arrays with for loop like List.Add([ i ])=Console.ReadLine(); Can we do something like that for Lists? or are they only added manually for Website application
@eeronat
@eeronat Год назад
On behalf of Lists everywhere, I take exception, sir, to your characterization of Lists as "wasting" more memory. It is true that Lists use more memory than arrays; but we'll have you know that those memory resources are very well spent!
@raunakbasnet7955
@raunakbasnet7955 Год назад
I was trying to move from js to C# ,array in C# was feeling so uncomfortable for me. This video made me clear how do i create array as js in C#.
@moorurr
@moorurr 9 месяцев назад
youre so good at explaining things oh my god
@spartanranger
@spartanranger 3 года назад
Thanks for the video Bro.
@yeetswa
@yeetswa 2 года назад
very clear and helpful thankyou
@warrenaustin4083
@warrenaustin4083 Год назад
This video helped me so much, thanks
@RickVegasGames
@RickVegasGames 11 месяцев назад
I literally never knew the difference between list and array until the 0:18 second of this. Thank you!
@gingr4002
@gingr4002 Год назад
The best explanation and thankfully for VDO.
@lavish1673
@lavish1673 Год назад
This cleared everything about lists , Thanks
@pydzio
@pydzio 2 года назад
Best explanation so far on RU-vid.
@simontillema5599
@simontillema5599 2 года назад
Perfect! Thank you!
@akshaysathyanath7755
@akshaysathyanath7755 2 года назад
import random print(random.randint(1,four twenty sixty nine))
@xxdangerxx1244
@xxdangerxx1244 2 года назад
yeah brou, your the best, gigachad
@springbertstudios7005
@springbertstudios7005 6 месяцев назад
Thanks this is going to help me a lot
@learnedjellyfish
@learnedjellyfish Год назад
This list method can be used to make a todo list, right?
@hellakuabb8166
@hellakuabb8166 11 месяцев назад
what about dynamic arrays?
@ab_obada5012
@ab_obada5012 11 месяцев назад
Thanks to your efforts :D
@abdelmawgood9282
@abdelmawgood9282 Год назад
Descriptive ,simple , concentrate and short video
@the_dude_josh
@the_dude_josh 9 месяцев назад
A random comment down below.
@IndustrialBonecraft
@IndustrialBonecraft 3 года назад
Is there any benefit to this over doing something like: string[] food = new string[] { "pizza", "hamburger", "hotdog", "fries"}; and then using '(0, food.Length);', which seems to circumvent the need to declare a definite array size?
@venatusgullebulle3389
@venatusgullebulle3389 2 года назад
I don't quiete have an answer for you but my teacher which owns his own tech company says that you almost never use arrays since lists are much friendlier for continuous development. The only time to use arrays is for things which are actually 100% certain, like there are only 12 months in a year, you don't need a list for that.
@zandemon
@zandemon 5 месяцев назад
Super random comment 9999
@FunnySubmarine-ij4zk
@FunnySubmarine-ij4zk 7 месяцев назад
Thank you. These short refresher videos are good.
@lesegoseko5920
@lesegoseko5920 4 месяца назад
you are the best 🔥🔥🔥🔥🔥
@syafiqbasri_
@syafiqbasri_ Год назад
W channel. Tq very much sir!
@FedoraChan
@FedoraChan Год назад
You're the goat Mr Bro !
@MasterIsroilov-o9q
@MasterIsroilov-o9q 3 месяца назад
Nice clases Bro!
@zvonkocosic5939
@zvonkocosic5939 Год назад
How do you change number 3 to 0 in list? example: list numbers = new list {1,2,3,4,5,6,7,8,9}; Number 3 needs to be number 0. Is there any way to do some list.Replace() method or anything? Thank you.
@urano3604
@urano3604 Год назад
What if you use a " numbers.remove(3); numbers.insert(2, 0); " ?
@TacoLocous
@TacoLocous Год назад
numbers[2] = 0;
@mihaelh6783
@mihaelh6783 Год назад
Whenever there's a list of objects the objects always gotta be a food of sorts :) great video man.
@abdulpianist9731
@abdulpianist9731 Год назад
your type speed is insane
@FullExtension1
@FullExtension1 Год назад
you are such a bro, bro.
@EbKingSolomon
@EbKingSolomon Год назад
Love it!!!! Thanks for everything
@IsRaphaelGo
@IsRaphaelGo 16 дней назад
guh
@jonlbs7
@jonlbs7 10 месяцев назад
Very awesome .. thank you!!
@amjadhani8929
@amjadhani8929 Год назад
Best channel ever
@mateusw.
@mateusw. Год назад
Thank you. Helped me!
@Kingiman
@Kingiman Год назад
so you could use this to create an inventory system for a video game basically ?
@Ayman73795
@Ayman73795 Год назад
hello same name person just spelled differently.
@olutayodurodola5891
@olutayodurodola5891 Год назад
thanks for going straight to the point, nice tutorial
@superkingpunga
@superkingpunga 2 месяца назад
Shot bro.
@seckopi23
@seckopi23 Год назад
thanks for making this tutorial
@Wall_Man_Studio_WMS
@Wall_Man_Studio_WMS 2 месяца назад
Thanks
@bateriadelitio12v
@bateriadelitio12v 2 года назад
awesome, brooooooo!!!! thanks a lot
@mohamedabouzeid2936
@mohamedabouzeid2936 2 года назад
list is so similar to vector in C++
@queendreem-gk4is
@queendreem-gk4is 9 месяцев назад
thancks
@Rishabh-p5e
@Rishabh-p5e 8 месяцев назад
👍👍
@Proviper666
@Proviper666 2 года назад
Hi
@andrecoccoconde3668
@andrecoccoconde3668 2 года назад
Another great video my man.
@jillieduke
@jillieduke 2 года назад
OMG thank you ! :)
@simplyjemelah8276
@simplyjemelah8276 3 года назад
how to make multiple list?
@tbtmtfth
@tbtmtfth 10 месяцев назад
adsdadadassa
@abdulsametaybaz3321
@abdulsametaybaz3321 Год назад
good explanation
@EDW4RD249
@EDW4RD249 2 года назад
What if I need to udate the value in index 0?
@nikhilt3755
@nikhilt3755 2 года назад
food[0] = "new value";
@tanoryjakaperdana1419
@tanoryjakaperdana1419 Год назад
05:43 what is reverse for?
@easternunit2009
@easternunit2009 Год назад
It’s sorts it alphabetically, but in reverse.
@gaminggoddessaria
@gaminggoddessaria 2 года назад
yeah but how do you get one of the elements out of the list??
@simontillema5599
@simontillema5599 2 года назад
Same way as with an array: "string x = food[0];" for the first item in the list.
@HandlesAreStupid11
@HandlesAreStupid11 2 года назад
@@simontillema5599 I appreciate that a lot, this gave me what I needed to finish a project up. All I needed was to pull random objects from a list.
@whitedinamo
@whitedinamo 2 года назад
lesson check😇
@triton5457
@triton5457 2 года назад
pizza 🍕 😀
@alexmelamud9750
@alexmelamud9750 2 года назад
Thanks man
@thecutepro2447
@thecutepro2447 2 года назад
the best of the best!!
@jacobomisaelcanul6747
@jacobomisaelcanul6747 3 года назад
Very well explained
@augischadiegils.5109
@augischadiegils.5109 3 года назад
@hungdangviet8986
@hungdangviet8986 2 года назад
short and informative. I really love this.
Далее
C# List of objects 🦸‍♂️
3:29
Просмотров 60 тыс.
C# generics ⁉️
5:33
Просмотров 76 тыс.
КВН 2024 Встреча выпускников
2:00:41
ICT FREE PAPER CLASS | SEPTEMBER | WEEK 04
1:53:19
How to Program in C# - Arrays (E05)
17:01
Просмотров 439 тыс.
C# interfaces 🐟
5:38
Просмотров 133 тыс.
I built 10 web apps... with 10 different languages
14:23
how Google writes gorgeous C++
7:40
Просмотров 889 тыс.
Learn Linked Lists in 13 minutes 🔗
13:24
Просмотров 305 тыс.
C# enums 🪐
7:07
Просмотров 71 тыс.