Skip to Content
Expert C# 5.0: with the .NET 4.5 Framework
book

Expert C# 5.0: with the .NET 4.5 Framework

by Mohammad Rahman
December 2012
Intermediate to advanced content levelIntermediate to advanced
612 pages
14h 4m
English
Apress
Content preview from Expert C# 5.0: with the .NET 4.5 Framework

CHAPTER 9

images

Foreach and Iterator

This chapter will discuss the foreach statement and iterators block. The foreach statement is used to iterate an array or an object collection that implements the System.Collections.IEnumerable or System.Collections.Generic.IEnumerable<T> interface. The iterators block is also used to iterate through an array or an object collection based on the state machine generated automatically by the C# compiler.

State Machine

Throughout this chapter, you will explore how the C# compiler generates the state machine for an iterator block, what the states are that the state machine contains, and how the state transition takes ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Pro C# 5.0 and the .NET 4.5 Framework, Sixth Edition

Pro C# 5.0 and the .NET 4.5 Framework, Sixth Edition

Andrew Troelsen
C# 4.0 Unleashed

C# 4.0 Unleashed

Bart De Smet

Publisher Resources

ISBN: 9781430248606Purchase book