C# Yield - Creating Iterators for beginners
tutorialsEU - C# tutorialsEU - C#
19.6K subscribers
6,937 views
0

 Published On Mar 13, 2023

🔥 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: https://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: https://goo.gl/rBFh3x

C#:    / @tutorialseuc  
Facebook:   / tutorialseu-109380204093233  
LinkedIn:   / tutorialseu  
Discord:   / discord  

show more

Share/Embed