C# lists tutorial example explained #C# #list #tutorial // List = data structure that represents a list of objects that can be accessed …
30 Comments
Leave a Reply
You must be logged in to post a comment.
C# lists tutorial example explained #C# #list #tutorial // List = data structure that represents a list of objects that can be accessed …
You must be logged in to post a comment.
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<String> food = new List<String>();
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();
}
}
}
Man you sure know how to make a good, quick and easy to understand video.
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
Hi
Thanks man
Watched your video and instantly subscribed! A great Content β€οΈπ―β
Best explanation so far on YouTube.
Perfect! Thank you!
Thanks! Everything very good explained
yeah but how do you get one of the elements out of the list??
OMG thank you ! π
Very clear and Nice Explanation about list vs array "Thanks"
pizza π π
short and informative. I really love this.
What if I need to udate the value in index 0?
import random
print(random.randint(1,four twenty sixty nine))
very clear and helpful thankyou
lesson checkπ
Another great video my man.
very helpful and easy to understand π
Nice tutorial
Thanks
the best of the best!!
Thank you bin looking at C# lists vid but yours is the first that is clear enough to me.. really helpful thanks..
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?
how to make multiple list?
best coding tutorial youtuber ngl
Thanks for the video Bro.
Very well explained
β€
Thanks Bro!