C# Tutorial: Lists of Objects

Поділитися
Вставка
  • Опубліковано 7 лис 2024

КОМЕНТАРІ • 34

  • @balasenk
    @balasenk 4 роки тому +12

    Ian, i really appreciate your work. You way of approaching code is interesting, please do more. all the best.

    • @ianschoenrock2285
      @ianschoenrock2285  4 роки тому +5

      Thanks for the comment. I'm currently working on the twitter course, haven't been posting a ton lately because I've been doing more research with API deployments and making sure that I can teach it in the most beginner friendly way possible. More videos should be coming out soon though!

  • @marioluissaldanhasantos1286
    @marioluissaldanhasantos1286 3 роки тому

    I'm so pleased to watch your videos because you explain how to code so well and step by step. I really appreciate your help and please keep posting more videos about coding. You are fantastic. Cheers.

  • @Havok256
    @Havok256 4 роки тому +3

    Create a C# menu-driven console application using OOP concepts that comprises the following functionality,
    1- Ability to register a student details (Name, Gender & Age)
    2- Ability to view student list.
    3- Ability to view delete & edit students

    • @ianschoenrock2285
      @ianschoenrock2285  4 роки тому

      Sounds like a fun homework project. I would check out my video on Properties, Classes, and Objects. If you have a solid understanding of those and this video as well, then this project should be very do-able.

  • @alphasauroxviix4235
    @alphasauroxviix4235 3 роки тому

    this video is amazingly amazing, how you're not above 100k subscribers is beyond me, you earned yourself a new loyal subscriber my guy

  • @syedmubazir4371
    @syedmubazir4371 2 роки тому +1

    Simple and Awesome Content! ❤️⭐💯Thanks alot.

  • @gabrielfs4713
    @gabrielfs4713 2 роки тому

    Ian, tks man! I'm really enjoy this video. From Brazil.

  • @RobinNilsson-z7s
    @RobinNilsson-z7s Рік тому

    Hello, so I am working on making a simulation of a bus, I have managed to make passengers and make it store them, but I have run into problems now when it comes to making functions for the list of objects. Like for instance if I wanted the user to give a parameter of an age let's say 100-80. And then it returns the passengers that match that age. Can't seem to figure out how to do something like that.

  • @AremuKamal-j1n
    @AremuKamal-j1n Рік тому

    pls sorry for asking, pls why do you used for each

  • @-Plube-
    @-Plube- 2 роки тому

    How do I copy an array of these into another object using this list method. I see zero tutorials online.

  • @malinisaranya7191
    @malinisaranya7191 3 роки тому

    Ian , I have a list of 50000 record I read from sql ..now how to split the list into smaller list in c# ...Any idea?

  • @daniyalihsan4264
    @daniyalihsan4264 3 роки тому

    Hi lan I have a question that how can I assign a unique Guid to each object inside the collection of objects,so that later on it could help me in removing the specified object only through UI controls.

  • @aranya96
    @aranya96 3 роки тому

    I really appreciate your hard work. Is this possible to make it dynamic rather than raw code?

  • @zerosandones7547
    @zerosandones7547 3 роки тому

    do we need fields when creating a model class? or are the auto properties enough?

  • @josephozurumba
    @josephozurumba 4 роки тому

    This is a great content. My suggestion is try and re-arrange your C# tuorial, so they are in order. Topics are not sequential. A question for you, which book would you recomment for C#. Thanks

    • @ianschoenrock2285
      @ianschoenrock2285  4 роки тому +1

      I thought I arranged the videos in order but your right, I'm going to have to fix that. My favorite book on C# is "C# 7 and .NET Core 2.0". Its huge and goes over everything. Its what I base many of my tutorials off of. Here is a link: www.amazon.com/Professional-NET-Core-Christian-Nagel/dp/1119449278/ref=sr_1_3?dchild=1&keywords=C%237+and+.NET+Core+2.0&qid=1595977072&sr=8-3

  • @MuhammadAziz-tb8zr
    @MuhammadAziz-tb8zr 3 роки тому

    Can I ask. If I make list of button with code :
    List btn = new List();
    How can I add all of buttons in the list to forms's control?
    I tried using :
    This.Controls.Add(btn);
    But it's didn't work somehow.

  • @majesticartist8761
    @majesticartist8761 3 роки тому

    thank you man! you solved my problem

  • @phone6974
    @phone6974 3 роки тому

    Ian how to use this list in another class?

  • @1311kiewo
    @1311kiewo 3 роки тому

    Ian, how can I remove Contact Kenny?

  • @vova1165
    @vova1165 2 роки тому +1

    Thank you, that helpful

  • @sampathchaganty8519
    @sampathchaganty8519 2 роки тому

    how to fetch using name in list of objects

  • @Shakespeare1612
    @Shakespeare1612 4 роки тому

    How would you search for a contact with a specific name and then show that specific name and phone number?

    • @ianschoenrock2285
      @ianschoenrock2285  4 роки тому

      Great question. a simple way would be to loop through each item in the list and see if it is equal to the search text. if it is then return the desired information. Take a look at the example below:
      var searchText = "Ian";
      foreach(var contact in contacts)
      {
      if(contact.Name == searchText)
      {
      Console.WriteLine(contact.Name);
      Console.WriteLine(contact.PhoneNumber);
      }
      }
      I would highly suggest looking at my video that explains class properties because that is essentially all this is. Hope that helps!

  • @TauroChuck
    @TauroChuck Рік тому

    Thank you

  • @Shakespeare1612
    @Shakespeare1612 4 роки тому

    How can you deal with lists, inside of lists, inside of lists. Like a list of casinos, each of which has a list of tables, each of which has a list of card decks, each deck deals a number of games, each game has a list players and hands, a list of cards in a discard pile and a list of chips in the pot, as well as in each player's possession. Finally each hand has a list of cards. Let's go pro here. Let's conquer serious REAL WORLD use cases.

    • @ianschoenrock2285
      @ianschoenrock2285  4 роки тому +2

      if you want to nest lists you can just do List. For instance if I had a list of casinos and wanted to access the list of tables I would do the following:
      1. Create a casino class
      2. Create a table class
      3. Inside the table class add the properties (dealer, card deck, etc)
      4. Inside the casino class create a property that is a list of tables: public List tables {get; set;}
      5. inside your program create a list of casinos: List casinos = new List();
      6. Reference a specific table from a specific casino (in this case the fifth table from the first casino): casinos[0].tables[4]
      You can go as deep as you would like but that is the basic concept. Also keep in mind for this series we are explaining major concepts at a more surface level. There is a lot you could do with lists, but if you understand how a basic list is made and the relationship between your data then going deeper into it isnt terribly difficult. Hope this helps!

  • @Havok256
    @Havok256 4 роки тому

    how do you delete and edit

    • @ianschoenrock2285
      @ianschoenrock2285  4 роки тому

      Here is a link on how to delete a list item: stackoverflow.com/questions/18917725/c-sharp-remove-object-from-list-of-objects
      Here is a link on how to edit a list item: stackoverflow.com/questions/4914802/editing-an-item-in-a-listt
      Remember to practice the concepts not just copy the code!

  • @vycka7360
    @vycka7360 4 роки тому +1

    OOF, nice name

  • @143ryan8
    @143ryan8 3 роки тому

    If anyone is seeing this, how do I instead of .Add() change it to accept Inputs from users like console.readline() for Name, PhoneNumber and Age???

    • @daniyalihsan4264
      @daniyalihsan4264 3 роки тому

      Hi it is simple you should have to create a private field name(name,age,phone number ) and then assign the Console.ReadLine() based user input into it those private fields.and finally at the place of.add(place the above inputs).job done.