Part 26 Set operators in LINQ

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

КОМЕНТАРІ • 10

  • @RachitJain4U
    @RachitJain4U 5 років тому

    Thank you sir. Video is Mind Blowing... :)

  • @sujitgujrathi814
    @sujitgujrathi814 10 років тому

    Really gr8 videos.... I will glad if you can upload video for unit testing...

  • @Vivalavidapool
    @Vivalavidapool 8 років тому

    cool, what if I only want either ID's, or only name, or a combination of different values to be distinct using Linq syntax?
    Thanks Venkat! :)

  • @MohammedNoureldin
    @MohammedNoureldin 7 років тому +2

    Could some one please explain to me why did we use XOR operator to combine both HashCodes? I couldn't understand that.

    • @piurek10
      @piurek10 7 років тому +1

      to get int value unique for this combination of two properties.

  • @dansanger5340
    @dansanger5340 10 років тому

    Cool. I never knew that about anonymous types.

  • @jiturcm1
    @jiturcm1 10 років тому

    nice

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

    Why such things have been made complicated.

  • @engineer.me.108
    @engineer.me.108 5 років тому

    var varEmployees = new[]
    {
    new {ID=1, Name="E1"},
    new {ID=1, Name="E1"},
    new {ID=2, Name="E2"},
    };
    var result = varEmployees.Distinct();
    foreach (var employee in varEmployees)
    {
    MessageBox.Show(employee.Name);
    }
    //I get E1, E1, E2

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

      1.) If you're storing your "Distinct()" sequence within the "result" variable then why are you enumerating through "varEmployees" instead of enumerating through "result"? 🤣🤣
      2.) Even if you did enumerate through "result", you won't get distinct records because you haven't projected employees' "ID" and "Name" into a new anonymous type within your "Distinct()" operator.