Part 74 List collection class in c#

Share
Embed
  • Published on Aug 29, 2013
  • Tags
    c# list foreach example
    c# list for loop
    c# list benefits
    c# list advantages
    c# access list element
    c# list add item
    c# list get all elements
    c# list insert item at index
    c# list insert at beginning
    c# list get element at position
    c# list insert method
    c# list class example
    c# list indexof method
    c# get list item index
    Difference between generic and non generic collections
    thexvid.com/video/ecbv4bsxkvk/video.html
    Link for code samples used in the demo
    csharp-video-tutorials.blogspot.com/2013/08/part-74-list-collection-class-in-c.html
    Link for csharp, asp.net, ado.net, dotnet basics, mvc and sql server video tutorial playlists
    thexvid.com/user/kudvenkatplaylists?view=1&sort=dd
    List is one of the generic collection classes present in System.Collections.Generic namespcae. There are several generic collection classes in System.Collections.Generic namespace as listed below.
    1. Dictionary - Discussed in Parts 72 & 73
    2. List
    3. Stack
    4. Queue etc
    A List class can be used to create a collection of any type. For example, we can create a list of Integers, Strings and even complex types. The objects stored in the list can be accessed by index. Unlike arrays, lists can grow in size automatically. This class also provides methods to search, sort, and manipulate lists.

Comments • 79

  • Diverspud PH
    Diverspud PH 5 months ago

    Very clear and understandable. Six years from when you made this video, it is still helping people like me!

  • foda-se
    foda-se 5 months ago

    thanks dude

  • Neethu M
    Neethu M 5 months ago

    Thank you.. Can you do a video on ILIST and ICOLLECTION?

  • Shanthosh Siva
    Shanthosh Siva 6 months ago

    super

  • Lilian Gassmann
    Lilian Gassmann 8 months ago

    I (as a non-english native speaker) usually have trouble concentrating on videos with an Indian accent (-sorry for that sad assesment). But this dude is very didactic, expressive and illustrates every point very well! Hugely Recommend his different videos on different reference points for beginners or quick access to specific info!

  • NARMADA SAHU
    NARMADA SAHU 10 months ago

    Thanks a lot! sir..could u give me idea to how to bind a method from another class into list class

  • Data Khukhua
    Data Khukhua 11 months ago

    TY for this One , easy to understand and get many info in 16 minute

  • Josy Pam
    Josy Pam Year ago

    What an awesome teacher you are!

  • akanksha kumari
    akanksha kumari Year ago

    really nice :)

  • akanksha kumari
    akanksha kumari Year ago

    Sir can we get the softcopy of these programs?

    • kudvenkat
      kudvenkat  Year ago

      You can find the soft copy of C# tutorials at the following link
      csharp-video-tutorials.blogspot.co.uk/p/free-c-video-tutorial-for-beginners.html
      Slides in image format are available at the following link
      csharp-video-tutorials.blogspot.com/p/c.html

  • Trzbne
    Trzbne Year ago

    "Absolutely" - this is my new favorite word :-) You are an absolutely excellent teacher :-)

  • Vimal Prajapati
    Vimal Prajapati Year ago

    how to convert system.generic.collections.list to string or char or vice versa

    • vinay kumar
      vinay kumar Year ago

      can you please explain in more detailed manner what u are exactly try to do or what you want to do

  • Krishna S Acharya
    Krishna S Acharya 2 years ago

    Hi sir, please make videos on all concepts of WPF... it's a humble request..

  • youcef kherifi
    youcef kherifi 2 years ago

    thank you

  • Dineshkumar Achari
    Dineshkumar Achari 2 years ago

    Wow!! Super Useful This Video .Thank You !!!

  • YouTube Boy
    YouTube Boy 2 years ago

    Avoid Exception use
    for(int i=0 ; i

    • Trzbne
      Trzbne Year ago

      It will stop before the last item of the List. i < Customer.Count is good, and i

  • Michael Knox
    Michael Knox 2 years ago

    Thank you so much

  • Ganesh G
    Ganesh G 2 years ago +1

    How to solve out of range exception in collection class case. Reply me with answer . Thanks in advance.

  • Slobodan Tajisic
    Slobodan Tajisic 2 years ago

    What's the point of the list initial capacity ?

  • Alejandro Y
    Alejandro Y 2 years ago

    Thanks, very helpful

  • Raju Saini
    Raju Saini 2 years ago

    simple example with good explanation, very nice :)

  • Leo Family
    Leo Family 2 years ago

    One of the best C# tutorials I've seen so far. Thanks so much!

  • La fille zen
    La fille zen 3 years ago

    very good video, very clear - thank you !

  • La fille zen
    La fille zen 3 years ago

    Very clear, Thank you !

  • faisal yousfani
    faisal yousfani 3 years ago

    sir please can you make me clear that whats the diff btw Customer customer1=new Customer(){}; statement and Customer customer1=new Customer(); waiting for your response .. :)

    • faisal yousfani
      faisal yousfani 3 years ago

      ohkay thank you so much :)

    • Liam2349
      Liam2349 3 years ago +2

      Including the extra brackets {} on the end allows you to initialize some fields when you create the Customer object.
      If you don't include those brackets, then you can initialize the fields later on.

  • Nate L
    Nate L 3 years ago

    What would be the point of setting the length of a list if a list can change so freely? Thanks for the great videos!

    • vinay kumar
      vinay kumar Year ago

      If you specify the length of the list it will initially have that many value and doubles the given length.
      Example: let us say if we specify capacity to 6 after reaching max of 6 it will be incremented to 12 after that 24......
      but where as if you don't specify length the default capacity at which it start would be 4 and when it exceeds 4 it will change to 8 next 16......
      this is what my understanding till now please let me know if there is some thing else I should know or if what I am understanding is not correct
      Thank you!

    • Liam2349
      Liam2349 3 years ago

      There isn't really a point, since Lists are self-optimizing, in that they control their capacity.
      It's just for demonstration purposes I think.

  • Joao M
    Joao M 3 years ago +2

    I usually can't stand the Indian accent in tutorials, it's the cadency of the words it distracts me because when you speak with an Indian accent in English the sound is usually flat and has stops after each word. Maybe I'm a dickhead but I'm specifically referring to the combination of flat English + Indian accent in tutorials. The reason why I'm making this statment is to let you know that this does not happen in this video! This tutor is fantastic, dispite having an Indian accent the narration is not flat and it's pleasent, the contents are on point, concise and clear, thank you so much! Subscribed!

  • Mido Gamal
    Mido Gamal 3 years ago

    love your video thank you

  • Pete Broomhall
    Pete Broomhall 3 years ago

    Brilliant video! Very easy to follow along with. Thanks.

  • Jose Cancel
    Jose Cancel 3 years ago +1

    In this video you have manually created 3 class instances. Could you tell me how I could dynamically create class instances based on generated lists?
    My question is explained in more detail here: stackoverflow.com/questions/35782580/creating-class-instances-based-on-dynamic-item-lists/35782803#35782803

  • Mo Chen
    Mo Chen 3 years ago

    I do believe the issue of list length has been handled in higher version

  • Michael Haddad
    Michael Haddad 3 years ago +2

    Thank you very much for this video. It is very helpful.
    Just one thing! it's "Customer" and not "Cusotmr" ;)

    • Erkut Eronat
      Erkut Eronat 3 years ago

      +Michael Haddad He doesn't say "Cusotmr." It is "Customr." It is a male clientele. For women, next door, we have "Customs." The "Cusotmr" you mention used to be the shop across the street that sold irregular items. They are out of business.

    • kudvenkat
      kudvenkat  3 years ago +4

      +Michael Haddad Thank you very much for taking time to give feedback. This means a lot. I am very glad you found the videos useful.
      I have organised all the Dot Net & SQL Server videos in to playlists, which could be useful to you
      thexvid.com/user/kudvenkatplaylists?view=1&sort=dd
      If you need DVDs or to download all the videos for offline viewing please visit
      www.pragimtech.com/kudvenkat_dvd.aspx
      Slides and Text Version of the videos can be found on my blog
      csharp-video-tutorials.blogspot.com
      Tips to effectively use my youtube channel.
      thexvid.com/video/y780MwhY70s/video.html
      If you want to receive email alerts, when new videos are uploaded, please subscribe to my youtube channel.
      thexvid.com/user/kudvenkat
      If you like these videos, please click on the THUMBS UP button below the video.
      May I ask you for a favor. I want these tutorials to be helpful for as many people as possible. Please share the link with your friends and family who you think would also benefit from them.
      Good Luck
      Venkat

  • Said Barke
    Said Barke 3 years ago

    I am lost at the insert part!

    • Peter Njenga
      Peter Njenga 3 years ago

      +Said Barke You you you you what are you doing here watching the same thing I'm watching

  • Bhawna Raghuvanshi
    Bhawna Raghuvanshi 3 years ago +2

    Your videos are really good and the way you teach is awesome. I learnt a lot from your videos. Thanks :)

  • deepak kumar
    deepak kumar 4 years ago +1

    great work....
    helped me a lott

  • Linexust Jk
    Linexust Jk 4 years ago +1

    how to get the "press any key to continue..." at the end.

    • Alejandro Y
      Alejandro Y 2 years ago +1

      Console.WriteLine("press any key to continue...");
      Condole.ReadKey();

    • Linexust Jk
      Linexust Jk 4 years ago +1

      Thank you for the response Venkat.. good day :)

    • kudvenkat
      kudvenkat  4 years ago +2

      @Linexust Jk Please use CTRL + F5 to run the application and you will get the option

  • Andrew Cox
    Andrew Cox 4 years ago

    Good videos. Goes just a little fast but after watching a couple of times I was able understand it.

  • Morten Albertsen
    Morten Albertsen 4 years ago

    Thank you for a great tutorial!
    They way you teach really gives me a good idea of how to build up my own code to complete the task, even though it wasn´t directly showed!

  • Simeon .Koprivlenski
    Simeon .Koprivlenski 4 years ago

    It would have been a good idea if you showed how to REVERSE,COPY AND CLONE arrays and List .

  • Gian-Luca Nardini
    Gian-Luca Nardini 4 years ago

    its not giving me the option to put in name or id and that

  • Nitin Deb
    Nitin Deb 4 years ago +5

    One word - Brilliant. :D

  • anis uddin
    anis uddin 4 years ago

    Thanks, cooool

  • Suresh Sundar
    Suresh Sundar 5 years ago

    simple example with good explanation, very nice :)

  • Jerell Mendoza
    Jerell Mendoza 5 years ago +10

    Wow, this guy is good. Clear and easy to understand and explores different methods of solving the same task

  • Mr Irrepressible
    Mr Irrepressible 5 years ago

    is it quicker to loop through a collection using use a foreach loop or a for loop?

  • Harish Rana
    Harish Rana 5 years ago

    Excellent tutorial. Very nice to the point. I have few questions on the list to use in my code, what is the best way to contact you?

  • Sala De Máquinas
    Sala De Máquinas 5 years ago

    Beautiful!!
    Thanks a lot! :D

  • Azizur Rahman
    Azizur Rahman 5 years ago

    Thanks

  • Mazdy Soraya
    Mazdy Soraya 5 years ago +1

    Thank you..Shared

  • ConaxHGG
    ConaxHGG 5 years ago +2

    Why does a customer has salary?

    • Ufuk Dilek
      Ufuk Dilek 5 years ago +9

      Because, customers without a salary are worthless

  • kudvenkat
    kudvenkat  6 years ago

    Can you please share a snapshot of the code where you are creating the list and the code that tries to retrieve it.

  • Dave @ Interact RDT
    Dave @ Interact RDT 6 years ago +1

    Hi again,
    I am creating my list in a method that uses a foreach loop to loop through the contents of a form and then creates a complex class each time to store the key/value pairs. This items are then added to the list.
    Could this be the reason that trying yo uI am able to successfully get the desired member.
    Could you possibly put a video together explaining these sorts of concepts?
    Dave

  • Dave @ Interact RDT
    Dave @ Interact RDT 6 years ago

    Hi Venkat
    I am getting an Argument out of range exception when trying to get a single value from a list using list[0].key. Weird thing is that if I count the string members or use a foreach loop to get all the members, I am getting valid outputs,
    Any suggestion?
    Dave

  • kudvenkat
    kudvenkat  6 years ago +2

    Hi Chandrashekar, you are 100% right. Thank you very much for taking time to answer this question. Keep up the good work of helping others. Appreciate your time and effort. Also, In the description of this video, I have included the link for the video that explains the difference between generic and non-generic collections.

  • kudvenkat
    kudvenkat  6 years ago +1

    Yes HashTable is also collection. It is a non generic collection. I have discussed the difference between generic and non-generic collections in c# tutorial. I have included the link in the description of this video.

  • kudvenkat
    kudvenkat  6 years ago +1

    Thank you very much for sharing the link with your circle.

  • Adriana MacLachlan
    Adriana MacLachlan 6 years ago

    awesome explanations

  • IMGWON
    IMGWON 6 years ago

    Hello Venkat Sir,Today I shared this channel among five different C#/.Net facebook groups and pages .I hope lots of coding enthusiast will be benefited like me, who can't pay bill or don't have time to join the classes. I did my bit and suggest everyone to do so.
    Happy Coding.

  • Chandrashekar B
    Chandrashekar B 6 years ago

    if any thing wrong venkat sir will correct it

  • Chandrashekar B
    Chandrashekar B 6 years ago

    Hash table is present in system.collection name space,It is a collection of key and value pairs like dictionary which is present insystem.collection.generic name space but in case of hash table both key and values are object type so we can add any type of data . but while looping
    through the hash table problem arises (because we need to type cast it to add object type while retrieving).means these are not strongly typed.so performance degradation will be there .