Part 26 Set operators in LINQ

แชร์
ฝัง
  • เผยแพร่เมื่อ 29 ม.ค. 2025

ความคิดเห็น •

  • @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...

  • @dansanger5340
    @dansanger5340 10 ปีที่แล้ว

    Cool. I never knew that about anonymous types.

  • @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.

  • @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.