C# Yield - Creating Iterators for beginners

  Рет қаралды 7,571

tutorialsEU - C#

tutorialsEU - C#

Күн бұрын

🔥 Is your code getting stuck iterating? Why not fetch data while it is iterating, avoiding freezes entirely? Well, with YIELD, you can do so!
🚀 C# Progress Academy - Become a job-ready C# and Angular web developer to land your dream developer role: bit.ly/45vbPUg
We'll make sure to turn you into a true developer in no time!
Timestamps:
00:00 Introduction
00:16 What do we need? And why do we want Yield?
01:36 Want to improve your C# Skills?
02:05 Let´s see a problem and build a solution using YIELD Return
05:38 Thanks for watching!
C# yield - creating iterators for beginners
So, what is C#?
C# (pronounced "See Sharp") is a modern, object-oriented, and type-safe programming language. C# enables developers to build many types of secure and robust applications that run in .NET. C# has its roots in the C family of languages and will be immediately familiar to C, C++, Java, and JavaScript programmers. This tour provides an overview of the major components of the language in C# 8 and earlier. If you want to explore the language through interactive examples, try the introduction to C# tutorials.
C# is an object-oriented, component-oriented programming language. C# provides language constructs to directly support these concepts, making C# a natural language in which to create and use software components. Since its origin, C# has added features to support new workloads and emerging software design practices. At its core, C# is an object-oriented language. You define types and their behavior.
And what is the Yield keyword?
You use the yield statement in an iterator to provide the next value from a sequence when iterating the sequence. The yield statement has the two following forms:
yield return: to provide the next value in iteration.
yield break: to explicitly signal the end of iteration.
The return type of iterators is IEnumerable (in non-generic cases, use IEnumerable as the return type of an iterator). You can also use IAsyncEnumerable as the return type of an iterator. That makes an iterator async. Use the await foreach statement to iterate over iterator's result.
To learn more, make sure to watch the video, and we promise you that you'll become a better developer by the end of the video! Have fun!
And thank you LAKEY INSPIRED for these amazing songs that we use in all our videos! @LAKEYINSPIRED
#csharp #coding #tutorial #learn #microsoft #net #yield #optimization
TAGS
c#,.net,c-sharp,csharp,programming,visual studio,c sharp,learn c#,c# programming,c# tutorial,c# for beginners,learn c# programming,c# course,tutorial,coding,c# multithreading,async,thread,multithreading,threading,c# one thread,c# async,core,code,task,async tutorial,asynchronous,shorts,dotnet,yield,ienumerable,yield return vs return c#,yield return,yield statement,yield return statement,iterator pattern c#,c# yield return,yield break,break,return,optimization
TutorialsEU offers you free video tutorials about programming and development for complete beginners up to experienced programmers.
This includes C#, Unity, Python, Android, Kotlin, Machine Learning, etc.
Stay tuned and subscribe to tutorialsEU: goo.gl/rBFh3x
C#: / @tutorialseuc
Facebook: / tutorialseu-1093802040...
LinkedIn: / tutorialseu
Discord: / discord

Пікірлер: 12
@tutorialsEUC
@tutorialsEUC 9 ай бұрын
🚀 C# Progress Academy - Become a job-ready C# and Angular web developer to land your dream developer role: bit.ly/45vbPUg
@benderios
@benderios Күн бұрын
The best explanation
@kopilkaiser8991
@kopilkaiser8991 11 ай бұрын
Definitely a must watch video for every programmer willingful to understand "yield" statement in C#. I myself, have been able to understand thanks to you🎉❤
@phattruong7086
@phattruong7086 3 ай бұрын
It's really really good, I can understand the "yield" in C# thanks for your video! Nice job!
@thomasschroter3802
@thomasschroter3802 6 ай бұрын
Nothing wrong with the content. However, this example shows well how much imperative programming interrupts the actual flow of the program and the developer is constantly forced to use control structures. A declarative approach would clearly have an advantage here.
@zane4218
@zane4218 17 күн бұрын
Is a yield return function setting up an isolated separate thread? That's what it feels like, but I'm having a little bit of trouble holding the logic in my head (which honestly is the case for a lot of multithreading, this would actually be simpler than normal for that.)
@kopilkaiser8991
@kopilkaiser8991 11 ай бұрын
⭐️⭐️⭐️⭐️⭐️
@Golden_games
@Golden_games Жыл бұрын
but if the max value is large will it not take longer and possibly throw an error
@hemanichius3941
@hemanichius3941 Жыл бұрын
You mean too large for an int
@Golden_games
@Golden_games Жыл бұрын
@@hemanichius3941 no I mean if you input a higher value like when he used 1billon will it not still take much time to complete
@MrOudoum
@MrOudoum Жыл бұрын
@@Golden_games Of course it does. Sadly he did not show the console then you would see why yield is very good in this situation. It will print the messages as soon as it iterates through each item because yield provides the next value in the iteration. Before the change to yield the methode had to finish (IEnumerable) and after that it will iterate through the foreach loop.
@sparkviral5844
@sparkviral5844 Жыл бұрын
Create a app pdfscanned to text file
C# Stress Testing your .NET applications
10:05
tutorialsEU - C#
Рет қаралды 5 М.
All Rust features explained
21:30
Let's Get Rusty
Рет қаралды 283 М.
Is it Cake or Fake ? 🍰
00:53
A4
Рет қаралды 17 МЛН
La revancha 😱
00:55
Juan De Dios Pantoja 2
Рет қаралды 31 МЛН
C# Yield Return: What is it and how does it work?
15:09
Brian Lagunas
Рет қаралды 54 М.
Master C# Interfaces in 12 Minutes - Beginner Tutorial
11:37
tutorialsEU - C#
Рет қаралды 15 М.
Tame the Power of the Iterator Pattern and yield return in C#
11:36
Singleton Design Pattern in C# - Do it THAT way
13:15
tutorialsEU - C#
Рет қаралды 21 М.
C# Async Yield Return: IAsyncEnumerable will change your life!!!
10:13
5 Design Patterns That Are ACTUALLY Used By Developers
9:27
Alex Hyett
Рет қаралды 185 М.
The weirdest way to loop in C# is also the fastest
12:55
Nick Chapsas
Рет қаралды 247 М.
Why Does Scrum Make Programmers HATE Coding?
16:14
Thriving Technologist
Рет қаралды 491 М.
Is it Cake or Fake ? 🍰
00:53
A4
Рет қаралды 17 МЛН