C# Async Yield Return: IAsyncEnumerable will change your life!!!

  Рет қаралды 25,600

Brian Lagunas

Brian Lagunas

3 жыл бұрын

Have you ever wondered if there was an async yield return in C#? Well, there is an async yield return and in this video, I'll show you how to use the yield return statement asynchronously in C#.
When you use the yield return statement in your code, you indicate that the method, operator, or get accessor in which the yield return keyword appears is an iterator. The yield return statement will return one one element in a collection at a time.
The result returned from a yield return iterator method can be consumed by using a foreach statement or LINQ query. Each iteration of the foreach loop calls the iterator method. When a yield return statement is reached in the iterator method, the result is returned and the current location in the iterator method is retained. Upon the execution of the next element in the foreach loop, the iterator method is restarted from the retained location the next time that the iterator method is called.
When working with asynchronous code using async/await, the use of the yield return statement requires just a few small adjustments to your code. Using an async yield return statement requires that the method be asynchronous, making use of async/await.
Usually an async method will return a task. Your first thought when using yield return in your async method may be to have the method return Task of IEnumerable. However, this is not allowed when using yield return, instead your async yield return method must return an IAsyncEnumerable.
You also cannot wait your new async yield return method that returns an IAsynEnumerable. Instead, yo must await the "foreach" statement instead. This is becuase IAsyncEnumerable does not have a GetAwaiter() method. IAsyncEnumerable is an async iterator.
Hopefully this video will help clear up the async yield return usage.
GitHub link: github.com/brianlagunas/Yield...
Be sure to watch my new Pluralsight course "Introduction to Prism for WPF":
📺 bit.ly/PrismForWpf
Sponsor Me on GitHub:
🙏🏼 bit.ly/SponsorBrianOnGitHub
Get 2 Free Stocks on WeBull (Valued up to $1600 when you deposit $100)
💰 bit.ly/BrianWeBull
Follow Me:
🐦 Twitter: bit.ly/BrianLagunasOnTwitter
📖 Blog: bit.ly/BrianLagunasBlog

Пікірлер: 191
@krzysztofpaszkiewicz1274
@krzysztofpaszkiewicz1274 3 жыл бұрын
Popped in my feed, didn't search for this video. Congrats, KZbin is recommending your videos for people learning c#.
@BrianLagunas
@BrianLagunas 3 жыл бұрын
Wow.... that's awesome. Thanks for letting me know. Exciting times
@WillEhrendreich
@WillEhrendreich 3 жыл бұрын
Oh my goodness thank you so much for answering my question! That's so awesome!
@WillEhrendreich
@WillEhrendreich 3 жыл бұрын
I can't believe I missed it the day it came out!
@BrianLagunas
@BrianLagunas 3 жыл бұрын
You are very welcome! Thanks for the great question
@WillEhrendreich
@WillEhrendreich 3 жыл бұрын
@@BrianLagunas how would you go about testing iasyncenumerable?
@BrianLagunas
@BrianLagunas 3 жыл бұрын
@@WillEhrendreich Just test it like you would any task based method. If you are using Mock, there are some setups you can also use by returning yourData.ToAsyncEnumerable in the setup.
@misiekgud
@misiekgud Жыл бұрын
Wow, what a great video. You have a gift for explaining things that are not easy at all in a very simple manner. Way to go!
@BrianLagunas
@BrianLagunas Жыл бұрын
Thank you so much.
@tcopling
@tcopling 3 жыл бұрын
This video was really good; and it made sense. Awesome job Brian.
@BrianLagunas
@BrianLagunas 3 жыл бұрын
Thank you very much
@stephenmatey927
@stephenmatey927 3 жыл бұрын
This is a great explanation and demo!
@BrianLagunas
@BrianLagunas 3 жыл бұрын
Thank you very much
@danzk
@danzk 3 жыл бұрын
Life changed, thanks Brian!
@BrianLagunas
@BrianLagunas 3 жыл бұрын
Thank you for watching
@jiu6246
@jiu6246 2 жыл бұрын
I love your videos because you get straight to the point
@BrianLagunas
@BrianLagunas 2 жыл бұрын
Thank you so much.
@haule5844
@haule5844 3 жыл бұрын
wow, this is amazing. I expect next video. Many thanks
@BrianLagunas
@BrianLagunas 3 жыл бұрын
Thank you very much
@pratikranchhod889
@pratikranchhod889 3 жыл бұрын
Hey Brian you are simply great.. Really inspiring for the developers to change the way to write the code efficiently. Thanks.
@BrianLagunas
@BrianLagunas 3 жыл бұрын
Thank you so much for the kind words. It really helps motivate me to create more content.
@0xF81
@0xF81 Жыл бұрын
9:43 you have my subscription, you persuaded me
@BrianLagunas
@BrianLagunas Жыл бұрын
Thank you
@kingbirdfpv
@kingbirdfpv 2 жыл бұрын
Exactly what I need!! 👌🏼Cristal Clear explanation! 👏🏼👏🏼👏🏼Thanks!
@BrianLagunas
@BrianLagunas 2 жыл бұрын
Thanks for watching
@jahedurrahman3181
@jahedurrahman3181 2 жыл бұрын
Wow…love the way you explained!
@BrianLagunas
@BrianLagunas 2 жыл бұрын
Thanks for watching
@jihadfamily6127
@jihadfamily6127 2 жыл бұрын
Super awesome Brian, thanks
@BrianLagunas
@BrianLagunas 2 жыл бұрын
Thanks for watching
@pareshdehadray7414
@pareshdehadray7414 2 жыл бұрын
Excellent. Simple and crisp. Showed very well how to use IAsyncEnumerable!
@BrianLagunas
@BrianLagunas 2 жыл бұрын
Thanks for watching
@niangel2704
@niangel2704 4 ай бұрын
You are a star!! Thanx a lot for your tutorials Brian!! Best regards from Greece!!
@BrianLagunas
@BrianLagunas 3 ай бұрын
Thank you so much! I appreciate your support
@abexperience7555
@abexperience7555 Жыл бұрын
Very well explained Brian. I like the way how you compare it with your previous video of yield. Keep it up.
@BrianLagunas
@BrianLagunas Жыл бұрын
Thank you so much
@davidwhite2011
@davidwhite2011 3 жыл бұрын
Another one over the center field fence! Exactly what I was wondering about.
@BrianLagunas
@BrianLagunas 3 жыл бұрын
Thank you for watching
@dasfahrer8187
@dasfahrer8187 2 жыл бұрын
I use this to stream live FOREX prices from a broker. I'm so glad they put this in there.
@BrianLagunas
@BrianLagunas 2 жыл бұрын
Ahhh... good 'ol FOREX feeds. Not many people are exposed to those pains 🤣
@dasfahrer8187
@dasfahrer8187 2 жыл бұрын
@@BrianLagunas It's definitely an interesting animal. Thankfully the data has gotten a lot more reliable and accessible over the years.
@joeycopperson
@joeycopperson 2 жыл бұрын
Thank you. this was best explained here than anywhere else for my understanding
@BrianLagunas
@BrianLagunas 2 жыл бұрын
Thank you so much
@lucamoroni6594
@lucamoroni6594 3 жыл бұрын
So clear, thank you Brian :)
@BrianLagunas
@BrianLagunas 3 жыл бұрын
Thank you for watching
@udaysuddhala3512
@udaysuddhala3512 3 жыл бұрын
amazing video !! thanks for the clear explanation!! loved it
@BrianLagunas
@BrianLagunas 3 жыл бұрын
Thank you so much
@slowjocrow6451
@slowjocrow6451 8 ай бұрын
Great video thanks. Just popped into my feed and it helped me a lot to understand.
@BrianLagunas
@BrianLagunas 8 ай бұрын
I’m glad I could help
@zacky7862
@zacky7862 3 жыл бұрын
This is very helpful. Thank you so much for this great tutorial.
@BrianLagunas
@BrianLagunas 3 жыл бұрын
Thank you for watching
@beautifulheartsoothingreci28
@beautifulheartsoothingreci28 3 жыл бұрын
Awesome dude ! Very useful and I didn't know this before
@BrianLagunas
@BrianLagunas 3 жыл бұрын
Great to hear! Thanks for watching
@julianturner6203
@julianturner6203 3 жыл бұрын
Thanks for the explanation. Great content 👍
@BrianLagunas
@BrianLagunas 3 жыл бұрын
Thank you once again for your continued support
@germandf
@germandf 2 жыл бұрын
Great explanation!!! thanks!
@BrianLagunas
@BrianLagunas 2 жыл бұрын
Thanks for watching
@A8-Wolverine
@A8-Wolverine 10 ай бұрын
Very helpful video. Thankyou
@BrianLagunas
@BrianLagunas 10 ай бұрын
Thank you for watching
@avishalom14
@avishalom14 Жыл бұрын
Great explanation! thanks :)
@BrianLagunas
@BrianLagunas Жыл бұрын
Thanks for watching
@arielunanue4354
@arielunanue4354 10 ай бұрын
Great video, didn't know the IAsyncEnumerable 👍
@BrianLagunas
@BrianLagunas 10 ай бұрын
Glad I could help.
@swapnilgadge8125
@swapnilgadge8125 2 жыл бұрын
YOU ARE BOSS... you know that ❤, I have 10 years of experience in .NET Development but this is the first channel I have subscribed which talks about coding :)
@BrianLagunas
@BrianLagunas 2 жыл бұрын
Thank you so much
@jatingandhi1988
@jatingandhi1988 Жыл бұрын
Hey Brian, Thank you for the wonderful video. Could you elaborate what is happening under the hood of yield and IAsyncEnumerable?
@Jashobantac
@Jashobantac 3 жыл бұрын
Great explanation from the creator of Prism.. Had been a fan since quite sometime..
@BrianLagunas
@BrianLagunas 3 жыл бұрын
Thank you so much
@dobriyshapik
@dobriyshapik Жыл бұрын
@Brain thanks for a video, could you please answer in which case I should use async enumeration? Could I use it in the repository ? for examples to fetching data using where expression. What is the right type to return list or enumerable?
@carlandres3319
@carlandres3319 Жыл бұрын
Thank you very much 👏👏👏💯
@BrianLagunas
@BrianLagunas Жыл бұрын
Thank you for watching
@akmalbukhariev7932
@akmalbukhariev7932 Жыл бұрын
Very good thank you.
@BrianLagunas
@BrianLagunas Жыл бұрын
Thank you so much
@lmanes
@lmanes 3 жыл бұрын
you are just awesome!
@BrianLagunas
@BrianLagunas 3 жыл бұрын
Thank you so much for the kind words
@lmanes
@lmanes 3 жыл бұрын
@@BrianLagunas your videos helps a lot, they are very well planned and executed! Silverbullets for most topics! I cant stress enough how much it means! Thank you!!
@erik....
@erik.... 3 жыл бұрын
Thanks! I got interested how this "await foreach" would translate because I know "foreach (MyObject o in e) ..." translates to "while (e.MoveNext()) ..." and it turns out "await foreach" becomes "while (await e.MoveNextAsync()) ...". It makes it easier to remember if I know how it really works.
@BrianLagunas
@BrianLagunas 3 жыл бұрын
Great distinction!
@user-ce7zf9qp8w
@user-ce7zf9qp8w 3 жыл бұрын
学到了,谢谢老哥。thanks
@BrianLagunas
@BrianLagunas 3 жыл бұрын
非常感谢你
@tusharparab9866
@tusharparab9866 3 жыл бұрын
Great video
@BrianLagunas
@BrianLagunas 3 жыл бұрын
Thank you very much
@sergiotardo
@sergiotardo 2 жыл бұрын
amazing code !!!
@BrianLagunas
@BrianLagunas 2 жыл бұрын
Thank you
@sky49
@sky49 3 жыл бұрын
It’s great. I could solve my problem.
@BrianLagunas
@BrianLagunas 3 жыл бұрын
Wonderful. I'm so happy to hear that
@231kickback
@231kickback 3 жыл бұрын
Great video! I am glad you showed trying to wrap the get lines in a Task since that would have been my first go to attempt.
@BrianLagunas
@BrianLagunas 3 жыл бұрын
Thanks. I decided to do that because that's what I first tried when I was learning it 🤣
@hussainhussaini2267
@hussainhussaini2267 3 жыл бұрын
Your videos are great, I have your 🔔 on and don't miss a single video of you. I have a question which doesn't even need a video. Is the async - await approach best choice for IO operations in desktop applications like WPF and WinForms? Or I should consider using threads?
@BrianLagunas
@BrianLagunas 3 жыл бұрын
Async/await is perfect for IO operations. Don't use thread unless you absolutely need the extra control.
@ivandrofly
@ivandrofly 21 күн бұрын
Good one thanks :)
@fmonteiropt
@fmonteiropt 2 жыл бұрын
Subscribed!!
@BrianLagunas
@BrianLagunas 2 жыл бұрын
Thank you very much
@ronen124
@ronen124 8 күн бұрын
thank you a lot for the tutorial yet it throws me and error: The non-generic type 'IAsyncEnumerable' cannot be used with type arguments IAsyncEnumerable
@yevheniytymchishin8401
@yevheniytymchishin8401 3 жыл бұрын
Perfect!
@BrianLagunas
@BrianLagunas 3 жыл бұрын
Thank you
@neilvermeulen5283
@neilvermeulen5283 Жыл бұрын
Thank you.
@BrianLagunas
@BrianLagunas Жыл бұрын
You’re very welcome
@philippelhaus
@philippelhaus 3 жыл бұрын
Good stuff
@BrianLagunas
@BrianLagunas 3 жыл бұрын
Thanks for watching
@hesamkalhor3263
@hesamkalhor3263 2 жыл бұрын
AWESOME!
@BrianLagunas
@BrianLagunas 2 жыл бұрын
Thanks for watching
@eugene00777
@eugene00777 2 жыл бұрын
Hey Brian, We miss you
@BrianLagunas
@BrianLagunas 2 жыл бұрын
Thank you so much. My day job is keeping me really busy. I hope to get back to recording some new videos soon
@Tamer_Ali
@Tamer_Ali 3 жыл бұрын
Hi Brian, When to use Tuple and when to create a Class/Record? What are the benefits of using Tuple? When the use of Tuple is not recommended? Thanks
@BrianLagunas
@BrianLagunas 2 жыл бұрын
Thanks for the suggestion! As soon as I get some time I'll get back to recording videos.
@berndspautz6611
@berndspautz6611 3 жыл бұрын
Great explanation. I have a different question to prism. Is there a way to automatically set the focus to an textbox inside a usercontrol that has been activated using the regionmanager? The FocusManager isn´t working.
@BrianLagunas
@BrianLagunas 3 жыл бұрын
This isn't really Prism related, but focus in general is a pain. It will have to be done on the UI layer usually via behaviors or attached properties.
@dariofilcivonitram6161
@dariofilcivonitram6161 3 жыл бұрын
very nice
@BrianLagunas
@BrianLagunas 3 жыл бұрын
Thank you very much
@pixaz
@pixaz 8 ай бұрын
What about returning a IEnumerable ?
@kj2w
@kj2w 3 жыл бұрын
I have a question about being asked tech questions during an interview. I was asked a 3 times in different interviews "What is a delegate? / Explain delegate(s)". After being asked 1 time and not having an answer I learned that its sending a method as a parameter, but after 10 years I've gotten by without using delegates. "When would you want to use delegates in web development?"
@BrianLagunas
@BrianLagunas 3 жыл бұрын
A delegate is simply a pointer to methods with a particular parameter list and return type. When you instantiate a delegate, you associate its instance with a method with a compatible signature and return type. When you the call the delegate instance (or invoke it), you invoke the method the delegate points to. Delegates are used to pass methods as arguments to other methods. I hope that helps until I can do a video.
@jefftrajano9865
@jefftrajano9865 Жыл бұрын
Love it
@BrianLagunas
@BrianLagunas Жыл бұрын
Thanks for watching
@sheikhAbdelrahman
@sheikhAbdelrahman 23 күн бұрын
Nice!
@yevheniytymchishin8401
@yevheniytymchishin8401 3 жыл бұрын
What if I need to read into the ObservableColleciton? Does it bring some changes into the approach you described in the video?
@BrianLagunas
@BrianLagunas 3 жыл бұрын
Not sure what you mean exactly, but you can put any logic you wish into a "yield return" enumerator method. This is how LINQ works.
@hamzehatasheneh8319
@hamzehatasheneh8319 2 жыл бұрын
Really great stuff, how about memory streams and Yield? Do you any tutorial?
@BrianLagunas
@BrianLagunas 2 жыл бұрын
sorry, but I don’t have an videos on memory streams yet
@andreikashin
@andreikashin 3 жыл бұрын
Brian, could you please explain [Slim]Semaphore-ing
@BrianLagunas
@BrianLagunas 3 жыл бұрын
thanks for the idea
@BasketcaseSoftware
@BasketcaseSoftware 2 жыл бұрын
Well, @Brian, I came across your video because I came across an issue with the IAsyncEnumerable and yield return. Your exercise added an item that won't work for me. I don't want a delay but without anything awaited I get the a warning that it won't run asynchronously. Try your above project without the delay item and tell me how you fix that issue.
@BrianLagunas
@BrianLagunas 2 жыл бұрын
You need to await a Task based method in order to use it.
@BasketcaseSoftware
@BasketcaseSoftware 2 жыл бұрын
@@BrianLagunas Are you able to provide an example of what you mean? In my situation I'm writing a command line tool that is processing multiple, fixed-size files as part of image creation. Loading and processing in parallel or asynchronously would be an ideal situation. Given that async and parallel don't play very nice with one another...
@dawsigi
@dawsigi Жыл бұрын
that bright white is blinding :D
@prabhakaranvelliangiri9655
@prabhakaranvelliangiri9655 3 жыл бұрын
Hey Brain, public void RegisterTypes(IContainerRegistry containerRegistry) { containerRegistry.Register("UserServices"); containerRegistry.Register("TestService"); } How prism will create instance for 2 classes. Please post an small video explaining.
@tanthien1793
@tanthien1793 3 жыл бұрын
I love to see it on production
@BrianLagunas
@BrianLagunas 2 жыл бұрын
I use it in production 😃
@pgc1721
@pgc1721 3 жыл бұрын
Hi, Thanks for the nice demo. What If I want to break the WHILE loop, while the line data is being populated in the ListBox?
@pgc1721
@pgc1721 3 жыл бұрын
Thought of using Cancellation Token. But I would like to know your approach. Thank you in advance.
@pgc1721
@pgc1721 3 жыл бұрын
private async IAsyncEnumerable GetLines(string filePath, [EnumeratorCancellation] CancellationToken token) { string line; StreamReader file = new StreamReader(filePath); while((line = await file.ReadLineAsync()) != null) { await Task.Delay(400); yield return line; if(token.IsCancellationRequested) { yield break; } } }
@BrianLagunas
@BrianLagunas 3 жыл бұрын
@@pgc1721 You don't need the yield break logic, just pass the token to the Task.Delay and it will throw the OperationCanceledException which will cancel it
@codingwithgyver1637
@codingwithgyver1637 3 жыл бұрын
wow, better implementation than Application.DoEvents or Control.Invoke() inside user-threads.
@BrianLagunas
@BrianLagunas 3 жыл бұрын
LOL... I agree 🤣
@Tamer_Ali
@Tamer_Ali 3 жыл бұрын
Long...long...long time no see Brian. Where are you? I missed your live streaming. I hope you are ok.
@BrianLagunas
@BrianLagunas 3 жыл бұрын
Everything is good. Just working my day job. Hoping to get time to record more content soon.
@bity-bite
@bity-bite 3 жыл бұрын
Can you please talk about the difference between "x:Name" and "Name" in WPF
@BrianLagunas
@BrianLagunas 2 жыл бұрын
What could be a nice short video. Thanks for the idea
@nickbutcher5098
@nickbutcher5098 3 жыл бұрын
Brian, could you show your method of using the SecureString in Prism/WPF/MVVM? For instance, I have service that I want to securely store the password in the app/ViewModel until the service method is called. Or point me to one of your previous posts/blogs.
@BrianLagunas
@BrianLagunas 3 жыл бұрын
SecureString actually isn't secure at all. You're better off just encrypting/hashing the password.
@nickbutcher5098
@nickbutcher5098 3 жыл бұрын
@@BrianLagunas Show us some encryption then 😀
@fred.flintstone4099
@fred.flintstone4099 Жыл бұрын
SecureString is not an alternative to encryption or hashing, it is a complement. Think layered security. SecureString is not when you already have a string and want to it be secure, it is when you want to read keyboard input, one character at a time, in a secure way, because with a regular string it would be stored in memory in the heap and you could inspect it with a memory debugger to uncover it.
@BrianLagunas
@BrianLagunas Жыл бұрын
It’s not a compliment either. It just makes the window getting the plain text shorter; it doesn't fully prevent it as .NET still has to convert the string to a plain text representation. Don’t ever use SecureString.
@morsheddld
@morsheddld 3 жыл бұрын
What is the neccessity of Yield return?? Did u check it by syncronisely ruuning it how much time it consumes?
@BrianLagunas
@BrianLagunas 3 жыл бұрын
I'm not sure I understand your question, but if you want to know how to use yield return synchronously watch this video: kzbin.info/www/bejne/foO7nJiXmq6gfdU
@mariomorazan9473
@mariomorazan9473 3 жыл бұрын
Brian, Im having a hard time programming a complex tables with custom rows and totals. is it WPF the right choice to make dynamic complex tables with many binding and calculations?
@BrianLagunas
@BrianLagunas 3 жыл бұрын
Not having any context to your problem, yes, you can build dynamic tables in WPF. You could also use a JavaScript stack. Just depends on the requirements of your app.
@mariomorazan9473
@mariomorazan9473 3 жыл бұрын
@@BrianLagunas how can i send you a file so maybe you can get a look into it?
@BrianLagunas
@BrianLagunas 3 жыл бұрын
@@mariomorazan9473 while I would love to help, I just don't have the time. I'm so sorry.
@mariomorazan9473
@mariomorazan9473 3 жыл бұрын
@@BrianLagunas it's alright I wasn't expecting you to work for free. XD thank you anyways.
@Jashobantac
@Jashobantac 3 жыл бұрын
Hi Brian, In a delegate command, How to make a CanExecute evaluation based on completion of some task? Kind of Lazy Can Execute.
@BrianLagunas
@BrianLagunas 2 жыл бұрын
You don't 🤣
@Jashobantac
@Jashobantac 2 жыл бұрын
@@BrianLagunas that's sad.
@hussainhussaini2267
@hussainhussaini2267 3 жыл бұрын
My next question is: what's the point of using asynchronous programming in web apps or web APIs??? while there is no UI to be blocked? I mean there is a UI actually, but it is on the client side and running on another machine
@BrianLagunas
@BrianLagunas 3 жыл бұрын
I'm not as experienced with web APIs so I did some research and found this doc: docs.microsoft.com/en-us/aspnet/core/performance/performance-best-practices?view=aspnetcore-3.1. It states "Asynchronous APIs allow a small pool of threads to handle thousands of concurrent requests by not waiting on blocking calls. Rather than waiting on a long-running synchronous task to complete, the thread can work on another request."
@StefanLopuszanski
@StefanLopuszanski 3 жыл бұрын
We did something similar but looped coroutines in an async manner or something like that.
@BrianLagunas
@BrianLagunas 3 жыл бұрын
Interesting. Thanks for sharing
@vineetkumarsingh3155
@vineetkumarsingh3155 3 жыл бұрын
Can you make a video on Task v/s Threads
@BrianLagunas
@BrianLagunas 3 жыл бұрын
That's actually on my list. I just haven't gotten around to it yet
@bity-bite
@bity-bite 3 жыл бұрын
Hi Brian! Have you considered creating a Discord server specifically for your YT channel?
@BrianLagunas
@BrianLagunas 3 жыл бұрын
I have, but I'm not sure anyone would really want to join it. Plus with my limited amount of time I'm not sure how often I could participate myself.
@bity-bite
@bity-bite 3 жыл бұрын
@@BrianLagunas You almost have 10K subscribers, which is a big number if you think about it. I just thought it'd help you to build a community base (BTW Sorry for writing "Brain" instead of "Brian".)
@BrianLagunas
@BrianLagunas 3 жыл бұрын
You're right. 10K is a lot. I will think about it a little more. I would just want to make sure that it would provide value to people.
@mariomorazan9473
@mariomorazan9473 2 жыл бұрын
Brian, it's me again. Let's make it hard (to me) how can you set the ambient for binding like datacontext in a dependencyobject.
@BrianLagunas
@BrianLagunas 2 жыл бұрын
I'm sorry, but I don't understand your question. What do you mean by "set the ambient for binding"
@abdulkapoor4059
@abdulkapoor4059 3 жыл бұрын
I have two list object and contains crores of data in both list. I want to loop through with one other list and return a new set of list. Can you please give me the best solution for this to reduce the performance issues?
@BrianLagunas
@BrianLagunas 3 жыл бұрын
Lots of ways to do this. You can use firstList.Concat(secondList), you can use firstList.AddRange(secondList), you can use secondList.ForEach(item => firstList.Add(item)), you can use yield return to return each item from each list. Those are just the ones I can think of off the top of my head. I am sure there are more.
@keyvankabirnia2609
@keyvankabirnia2609 2 жыл бұрын
Hi Brian, long time no feed... is everything ok? We miss u. (K1)
@BrianLagunas
@BrianLagunas 2 жыл бұрын
Yes, everything is good. I have been really busy at work and then I have been on vacati0n. I will be back soon.
@adinwashere
@adinwashere 3 жыл бұрын
In VB6 i'd just add DoEvents inside the loop. BAM, UI is responsive again! Ah... The good ol' days
@BrianLagunas
@BrianLagunas 3 жыл бұрын
🤣🤣🤣 I remember those days. Good times
@sarathir6825
@sarathir6825 3 жыл бұрын
How to use IAsyncenumerable in CQRS , MediatR
@David-qz1rd
@David-qz1rd 3 жыл бұрын
Thanks a lot for your videos! 1. What to practice in order to be good at understanding complex systems? 2. How to get over the feeling of overwhelming when trying to learn? I always try to rush through a topic knowing that there are other stuff needed to be learnt.
@dsuess
@dsuess 3 жыл бұрын
@David P, do you have an example of a complex system and/or language(s) to target it with? For instance, in my department, we code for a 6-axis arm on a linear rail in the pharmaceutical robotics industry. This can be difficult for some, business as usual for others. Frankly, it's a really fun product line that flosses the brain daily.
@diegoronkkomaki6858
@diegoronkkomaki6858 3 жыл бұрын
Sorry for butting in but the answer for number 2 is kinda in the question. Don't try to rush through things. Test them yourself, even better if you have a project where you can use new functionality in a "real life" scenario. Even if a video is 10 minutes, it doesn't mean you will learn it in 10 minutes. Spend an hour or two mucking around with IAsyncEnumerable after watching this video. See how it behaves. Atleast this is how I learn things.
@BrianLagunas
@BrianLagunas 3 жыл бұрын
1. Complex systems don't start out complex. They all start out simple, and then complexity grows over time. Each system is also different, so there is not "one size fits all" approach to understanding complex systems. The only thing that will make a complex system easier to understand is spending time working in that system. 2. As @Diego pointed out, don't try to rush to learn something. Learning comes with time and experience working with something. The longer you work with it, the more you'll know about it.
@AhmedMohammed23
@AhmedMohammed23 3 жыл бұрын
what about a video for wpf datagrid filtering and grouping
@BrianLagunas
@BrianLagunas 3 жыл бұрын
I wouldn't recommend using the default data grid control. I would use a professional data grid from companies like Infragistics. If you must use the default data grid, to group and filter use a CollectionViewSource instead of an ObservableCollection
@AhmedMohammed23
@AhmedMohammed23 3 жыл бұрын
@@BrianLagunas yes i was looking for a video for CollectionViewSource with mvvm but what is wrong with the default datagrid control
@GeorgeTsiros
@GeorgeTsiros 2 жыл бұрын
dope
@BrianLagunas
@BrianLagunas 2 жыл бұрын
Thanks for watching
@nothingisreal6345
@nothingisreal6345 Жыл бұрын
Not available in .NET Framework.
@BrianLagunas
@BrianLagunas Жыл бұрын
Correct. Only available in .NET Core 3.0 and above
@ophelia6044
@ophelia6044 Жыл бұрын
Dude, why light mode, my eyes!!!
@BrianLagunas
@BrianLagunas Жыл бұрын
Dark mode sucks for most environments, especially when presenting.
C# Yield Return: What is it and how does it work?
15:09
Brian Lagunas
Рет қаралды 53 М.
Eccentric clown jack #short #angel #clown
00:33
Super Beauty team
Рет қаралды 25 МЛН
Super sport🤯
00:15
Lexa_Merin
Рет қаралды 20 МЛН
Tame the Power of the Iterator Pattern and yield return in C#
11:36
IAsyncEnumerable and Yield Return
14:23
Coding Tutorials
Рет қаралды 3,2 М.
That's NOT How Async And Await Works in .NET!
12:25
Codewrinkles
Рет қаралды 13 М.
IAsyncEnumerable, My Favorite C# 8 Feature That No One Is Using
11:02
Amichai Mantinband
Рет қаралды 23 М.
Which do I use, ConfigureAwait True or False?
6:53
Brian Lagunas
Рет қаралды 35 М.
Understanding how to use Task and ValueTask
26:59
Microsoft Developer
Рет қаралды 26 М.
do you know how "return" works under the hood? (are you SURE?)
5:08
Low Level Learning
Рет қаралды 345 М.
C# Yield - Creating Iterators for beginners
5:52
tutorialsEU - C#
Рет қаралды 7 М.
С Какой Высоты Разобьётся NOKIA3310 ?!😳
0:43
Топ-3 суперкрутых ПК из CompShop
1:00
CompShop Shorts
Рет қаралды 333 М.
Карточка Зарядка 📱 ( @ArshSoni )
0:23
EpicShortsRussia
Рет қаралды 354 М.
iphone fold ? #spongebob #spongebobsquarepants
0:15
Si pamer 😏
Рет қаралды 283 М.