C# Tutorial 13 LINQ Extension Methods

แชร์
ฝัง
  • เผยแพร่เมื่อ 9 พ.ย. 2024

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

  • @judasknox3354
    @judasknox3354 3 ปีที่แล้ว

    This tutorial was fun as advertised. Thank you.
    I noticed that we could compare at least, 3 lists, using Except and Intersect. Are the lists compared, then 'string.Join'(ed) or joined then compared?
    For other beginners like me, this is an example of Intersect for three lists... it worked for me:
    var numList9 = new List() { 1, 2, 3, 2, 3 };
    var numList10 = new List() { 2, 3 };
    var numList10a = new List() { 2, 3, 4 };
    Console.WriteLine($"second list 2,3,4; first list 1, 2, 3, 2, 3; third list 2, 3, 4;
    Intersect of all three lists : " +
    $"{string.Join(", ", numList10.Intersect(numList10a).Intersect(numList9))}
    ");

  • @2271masoud
    @2271masoud 7 ปีที่แล้ว +1

    I don't miss a single video even on my holiday.
    Thank you Derek

    • @derekbanas
      @derekbanas  7 ปีที่แล้ว +1

      I greatly appreciate that :)

  • @TheKatanowaki
    @TheKatanowaki 7 ปีที่แล้ว

    This is really powerful stuff. I use C# lambdas for everything.
    I've been using extension methods of IQueryable to build complex queries by chaining reusable chunks of lambdas. This seems to work great with EF deferred execution and helps abstract my business logic from the legacy db I'm working with.
    Also a tip for someone writing to console a lot: type "cw" + TAB + TAB is a snippet shortcut for Console.WriteLine.

    • @derekbanas
      @derekbanas  7 ปีที่แล้ว +1

      Yes I love all the awesome tools that come built into C# :)

  • @ics3217
    @ics3217 5 ปีที่แล้ว

    Great video! Helped me understand LINQ code a lot better. Just a small comment on Except(), it returns the set difference of the first list minus the second list (so it's like Distinct() plus also getting rid of the elements in the list argument for Except()).
    ...same for Intersect() too (returns the set of intersected elements).

    • @derekbanas
      @derekbanas  5 ปีที่แล้ว +1

      Thank you for the input 😁

  • @jshhwuiopq18266
    @jshhwuiopq18266 6 ปีที่แล้ว +1

    Honestly, this is the best channel on youtube.

    • @derekbanas
      @derekbanas  6 ปีที่แล้ว +1

      Thank you for the nice compliment :)

  • @patwicker1358
    @patwicker1358 7 ปีที่แล้ว +2

    Silver. Wow that implementation of Lists really has a lot of power!

    • @derekbanas
      @derekbanas  7 ปีที่แล้ว

      Thank you :) We're just getting started with manipulating lists

  • @fsacer
    @fsacer 7 ปีที่แล้ว +3

    You could simplify flipList.Where(a => a == 1).ToList().Count() to flipList.Count(a => a == 1).

    • @derekbanas
      @derekbanas  7 ปีที่แล้ว +6

      But then I couldn't use where :) Sorry I was just looking for an excuse to use it. Thank you for sharing

    • @MrSarky1992
      @MrSarky1992 5 ปีที่แล้ว

      @@derekbanas I believe where also returns an IEnumerable so you can use count() straight on that, no need to use ToList(). But Franci's solution is indeed the most elegant one.

  • @lendial
    @lendial 7 ปีที่แล้ว

    Thank you for doing these. The possession from simple to complex cases is very helpful.

    • @derekbanas
      @derekbanas  7 ปีที่แล้ว

      Thank you :) I'm happy you like them

  • @yandodov
    @yandodov 7 ปีที่แล้ว +1

    Derek, you are the best teacher on TH-cam! I love the way you present information! Are you considering making a video about ReactJS? It looks pretty darn cool!

    • @derekbanas
      @derekbanas  7 ปีที่แล้ว

      Thank you for the compliment :) Yes it is on my list. I want to cover Xamarin first and then I'll present React

  • @HYBRIDER-YT
    @HYBRIDER-YT 5 ปีที่แล้ว +2

    Great video! But I think I missed a lesson, which video talked about predicates? Thanks!

  • @OC-UK
    @OC-UK 7 ปีที่แล้ว +3

    (Hoping to learn something extra here..)
    Why did you need to use AsQueryable() when working out the average as Average() sits under the Enumerable class. If you removed the AsQueryable() call and just used .Average() it would have worked,
    Love the videos as always!

    • @willplaya9972
      @willplaya9972 6 ปีที่แล้ว +3

      This is late - but you don't :) Lists already implement IEnumerable - and linq expressions work on IEnumerable and IQueryable

  • @rambodehydrated
    @rambodehydrated 7 ปีที่แล้ว +16

    What do you need AsQueryable for? When you were looking for the average number?

  • @sanjaysinghbhandari3793
    @sanjaysinghbhandari3793 7 ปีที่แล้ว

    I truly appreciate your free videos thank you

    • @derekbanas
      @derekbanas  7 ปีที่แล้ว

      Thank you very much :) I'm glad you like them

  • @natarajboina7525
    @natarajboina7525 7 ปีที่แล้ว

    Hey Derek! Thanks for all these amazing videos!

    • @derekbanas
      @derekbanas  7 ปีที่แล้ว

      Thank you :) I'm happy you like them

  • @sandeepvk
    @sandeepvk 7 ปีที่แล้ว

    Missed your game play on Sunday. But I had a field time installing Django - so it made up for most part - LOL Have a nice week Derek

    • @derekbanas
      @derekbanas  7 ปีที่แล้ว

      That's because I didn't do it. You were the only person that asked for it so I would have been very lonely :) I'm finishing Inside tonight no matter how long it takes!

    • @sandeepvk
      @sandeepvk 7 ปีที่แล้ว

      That's the spirit ! Looking forward to it :)

  • @olafferguson6993
    @olafferguson6993 4 ปีที่แล้ว

    Silver. Thanks Derek!

  • @pickedupapencil
    @pickedupapencil 7 ปีที่แล้ว

    Nice video.
    I usually find converting everything to a list though isn't worth the overhead.

    • @derekbanas
      @derekbanas  7 ปีที่แล้ว

      Thank you :) Yes I tend to cover everything whether it is always the best to do or not

    • @pickedupapencil
      @pickedupapencil 7 ปีที่แล้ว

      Haha. I noticed. I used to do that a lot too. I was in love with them. I used them everywhere.

  • @stevefrt9495
    @stevefrt9495 6 ปีที่แล้ว

    Thanks you so much Derek

    • @derekbanas
      @derekbanas  6 ปีที่แล้ว

      Thank you for watching :)

  • @mahmuttr
    @mahmuttr 5 ปีที่แล้ว

    linq methodları senle öğrenmek çok güzel.

  • @luckyspade8786
    @luckyspade8786 7 ปีที่แล้ว

    Your tutorials are awesome like always
    Thanks man :)

    • @derekbanas
      @derekbanas  7 ปีที่แล้ว +1

      Thank you very much :)

  • @swadhatripathi9623
    @swadhatripathi9623 7 ปีที่แล้ว

    Could you please create and share a video on smalltalk Pharo.
    Thanks for all the awesome lessons.

    • @derekbanas
      @derekbanas  7 ปีที่แล้ว

      Thank you :) I'll see what I can do

  • @SunnyApples
    @SunnyApples 7 ปีที่แล้ว

    Thank you very much for uploading!

    • @derekbanas
      @derekbanas  7 ปีที่แล้ว

      I'm very happy that you liked it :)

  • @christianrodier3381
    @christianrodier3381 5 ปีที่แล้ว

    That was very helpful, thanks!

    • @derekbanas
      @derekbanas  5 ปีที่แล้ว

      Happy I could help :)

  • @mycodeevolution2555
    @mycodeevolution2555 7 ปีที่แล้ว

    Silver. Two thumbs up!

    • @derekbanas
      @derekbanas  7 ปีที่แล้ว

      Thank you for doing that :)

  • @raphaelbernard7954
    @raphaelbernard7954 7 ปีที่แล้ว

    Hi Mr Banas you said for us to create a triangle class for the last vid but you seemed to create it of t type also ?

  • @bartonpaullevenson3427
    @bartonpaullevenson3427 6 ปีที่แล้ว

    Good one as usual.

  • @chasenbettinger9651
    @chasenbettinger9651 7 ปีที่แล้ว

    Derek, thank you again for taking time to make this video. Can you recommend any literature or youtubers to learn more about web frameworks (ReactJS, html, css)? Thank you so much!

    • @derekbanas
      @derekbanas  7 ปีที่แล้ว +1

      I'm happy you liked it :) Sorry I don't watch other tutorials on TH-cam because I don't like to be influenced. I'm sure the top search results should be good. Amazon is also pretty good at recommending good books.

    • @chasenbettinger9651
      @chasenbettinger9651 7 ปีที่แล้ว

      Derek Banas thanks Derek. You are my go to source for general programming. Love the tutorials. I tell people at my university who need help to watch you

    • @derekbanas
      @derekbanas  7 ปีที่แล้ว

      Thank you very much for telling others :)

  • @kojoig
    @kojoig 7 ปีที่แล้ว

    Best tutorials, thank you.

  • @robertslamon4403
    @robertslamon4403 6 ปีที่แล้ว

    Excellent vid!

  • @RaGePr00fs
    @RaGePr00fs 7 ปีที่แล้ว

    hello Derek, a indeed very interactive video and a very efficient information projeecting, keep the good work.
    Anyway I was thinking of asking you maybe to start a series about how to build a IOS app? If , of course, you can do it.
    that would be much appreciated and I think most of us agree that it would amazing to have it.Please share your feedback

    • @derekbanas
      @derekbanas  7 ปีที่แล้ว

      Thank you :) I'll start making iOS apps very soon using Xamarin

  • @loam
    @loam 5 ปีที่แล้ว

    That envelope (7:50) reminded me of loading screens in some old war related game (Medal of Honor or Call of Duty), anyone else?

  • @GFLUTOMAN
    @GFLUTOMAN 7 ปีที่แล้ว

    Hey Derek, do you think you could do a MATLAB tutorial?

    • @derekbanas
      @derekbanas  7 ปีที่แล้ว

      Yes it is on the list

    • @stillww
      @stillww 7 ปีที่แล้ว +1

      Is there a programming language you don't know?

  • @coolunknown7846
    @coolunknown7846 7 ปีที่แล้ว

    Hey Derek, do you already know when Xamarin is coming? btw, awesome tut!

    • @derekbanas
      @derekbanas  7 ปีที่แล้ว

      Thank you :) I'm not sure if I'm covering MonoGame or Xamarin next. I may hold a vote

    • @coolunknown7846
      @coolunknown7846 7 ปีที่แล้ว

      Derek Banas Ok, cool

  • @gimmie92895
    @gimmie92895 5 ปีที่แล้ว

    excellent video!! learned a lot from it! make some more please :)))

    • @derekbanas
      @derekbanas  5 ปีที่แล้ว

      I'm happy to help :)

  • @gimmie92895
    @gimmie92895 5 ปีที่แล้ว

    make a video about bubble sort, thats the thing that is most difficult at least for me

    • @derekbanas
      @derekbanas  5 ปีที่แล้ว

      I cover the bubble sort here in Java which is pretty easy to translate into C# th-cam.com/video/JUOyKSZScW0/w-d-xo.html

  • @hellomylitlttlefrend
    @hellomylitlttlefrend 7 ปีที่แล้ว

    Would you be able to cover Streams at some point ? They've been confusing me recently.

    • @derekbanas
      @derekbanas  7 ปีที่แล้ว +1

      Yes for sure :)

  • @vinuhosanagar1
    @vinuhosanagar1 7 ปีที่แล้ว

    Hi Derek. Thank you for another tutorial. I can devote 3 hours a day. Can you please tell me how do I get entry level job as a mobile developer using Xamarin. How long it may take to get skilled if I follow your tutorials regularly?

    • @derekbanas
      @derekbanas  7 ปีที่แล้ว +1

      Hi, I always got jobs by finding people that worked where I wanted to work. I'd ask them what skills I needed, who I should talk to about getting a job, what is asked in interviews, etc. I'll get to Xamarin soon. I personally am I consultant and I don't call myself a Xamarin developer, but rather a mobile developer.

  • @coolkidmcoy
    @coolkidmcoy 7 ปีที่แล้ว

    Most of these seem to map to Scheme higher order functions, like map and filter. In the case of aggregate, is a it a foldr or foldl or does it not matter? I see you picked sum but something, like subtract or join, would have vastly different results depending on the order of operation. Any ideas?

  • @exzm2580
    @exzm2580 7 ปีที่แล้ว

    Nice video as always Derek :) I was wondering when are you going to upload the swift tutorial and are you still planning to do linux videos? I'm okay with everything you upload :)

    • @derekbanas
      @derekbanas  7 ปีที่แล้ว

      Thank you :) I can make a Swift tutorial fairly easy. I just need to fit it in the schedule. Sorry for the wait

    • @exzm2580
      @exzm2580 7 ปีที่แล้ว

      +Derek Banas It's okay:) Thank you very much though.

  • @clashgamerxp8507
    @clashgamerxp8507 7 ปีที่แล้ว +1

    awesome video like always thanks :)

    • @derekbanas
      @derekbanas  7 ปีที่แล้ว +1

      Thank you very much :)

    • @sanjaysinghbhandari3793
      @sanjaysinghbhandari3793 7 ปีที่แล้ว

      I am glad to have a teacher like you

    • @derekbanas
      @derekbanas  7 ปีที่แล้ว

      Thank you :) I'm happy you find the videos useful

  • @okanciftci4880
    @okanciftci4880 7 ปีที่แล้ว

    Pretty Cool

  • @Ibnblackbird
    @Ibnblackbird 7 ปีที่แล้ว

    Love your videos

    • @derekbanas
      @derekbanas  7 ปีที่แล้ว

      Thank you very much :)

  • @jacobc8388
    @jacobc8388 7 ปีที่แล้ว

    Hi Derek, Could you please do tutorials with Google maps API

    • @derekbanas
      @derekbanas  7 ปีที่แล้ว

      Hi Jacob, Have you seen this www.codeproject.com/articles/32643/gmap-net-great-maps-for-windows-forms-and-presenta

    • @jacobc8388
      @jacobc8388 7 ปีที่แล้ว

      I have seen this project before. However, I'm looking more for a video tutorial that helps me to create an interactive map on the web by using API platform (like Google maps Leaflet or OpenLayers).

  • @neelimgoswami6336
    @neelimgoswami6336 6 ปีที่แล้ว

    can you please please make a series on how to make a game engine(with some gui like the paint app )

    • @derekbanas
      @derekbanas  6 ปีที่แล้ว

      I'll see what I can do. I already have a How to Make Video Games tutorial series

  • @mra7mad693
    @mra7mad693 7 ปีที่แล้ว

    hi derek big fan will you do delphi video

    • @derekbanas
      @derekbanas  7 ปีที่แล้ว

      Thank you :) It is on the list

  • @Almarghulani
    @Almarghulani 7 ปีที่แล้ว +1

    Why is there a small second cursor when you zoom in? Its really annoying :D Its like when somebody takes up two parking spaces for one car, nothing harmful, but annoying :D :D... amazing videos btw

    • @derekbanas
      @derekbanas  7 ปีที่แล้ว +3

      Thank you :) Sorry my capture software has a bug. I'd use something else, but they all seem to have one problem or another.

  • @ellena1903
    @ellena1903 7 ปีที่แล้ว

    Silver!

  • @viral185
    @viral185 7 ปีที่แล้ว +2

    What are all programming languages to know to make an application or game on PC and what programming languages to make a game on Android

    • @derekbanas
      @derekbanas  7 ปีที่แล้ว +2

      The answer to both questions in my opinion is C#. I'll be making apps and games with C# very soon

    • @viral185
      @viral185 7 ปีที่แล้ว

      Derek Banas how cross platform is c#?

    • @viral185
      @viral185 7 ปีที่แล้ว

      Derek Banas also isn't c++ a better option?

    • @derekbanas
      @derekbanas  7 ปีที่แล้ว +1

      You can develop for any platform with C#

    • @derekbanas
      @derekbanas  7 ปีที่แล้ว +3

      No C++ doesn't have the tools that make it easy to develop desktop apps, mobile apps, or games. C++ is best used for low level hardware. C++ is made for making graphics engines, but there is no reason to make a graphics engine when you can use someone elses.

  • @JackBauerDev
    @JackBauerDev 7 ปีที่แล้ว

    Is there a difference between count and count() ?

    • @TheKatanowaki
      @TheKatanowaki 7 ปีที่แล้ว

      AFAIK, count() is a Linq extension method (meaning you need Linq as a dependency) and Count is a property of ICollection (which List implements).
      If you call Count() method on something that implements the Count property, it returns the Count property. If it doesn't implement Count property, then it will just iterate through the collection and count the objects.
      This might explain more:
      stackoverflow.com/questions/4098186/lists-count-vs-count

  • @a.b_shots
    @a.b_shots 7 ปีที่แล้ว

    Silver! :D

    • @derekbanas
      @derekbanas  7 ปีที่แล้ว

      Thank you for doing that :)

  • @redlamaravind104
    @redlamaravind104 2 ปีที่แล้ว

    Code Snippet is not opening !!
    could u reshare the code link here..

  • @maxbrodskyi3046
    @maxbrodskyi3046 6 ปีที่แล้ว

    Silver

    • @derekbanas
      @derekbanas  6 ปีที่แล้ว

      Thanks for watching the whole video :)

  • @Ben-ym4de
    @Ben-ym4de 7 ปีที่แล้ว

    Silver :)

    • @derekbanas
      @derekbanas  7 ปีที่แล้ว

      Thank you for that :)

  • @haniba5
    @haniba5 7 ปีที่แล้ว

    Hello Derek
    How you switch on this lines vertical and horizontal which help to see if brackets are in right position? drive.google.com/file/d/0BwOXByyTdDDGX0ZKZTVpcUx2c2c/view?usp=sharing

    • @derekbanas
      @derekbanas  7 ปีที่แล้ว

      I have line wrap turned on

  • @AshSlasher
    @AshSlasher 6 ปีที่แล้ว

    Lambda? Pff... Sounds like Greek to me.

    • @derekbanas
      @derekbanas  6 ปีที่แล้ว +1

      That's funny :)

  • @soapyfruit4731
    @soapyfruit4731 7 ปีที่แล้ว

    Silver :)