|
| ||||||||||
| Tags: c sharp, iterators, programming, software language |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| What do you mean by C# Iterators
|
|
#2
| |||
| |||
| Re: What do you mean by C# Iterators C# introduced a new concept called Iterators in C# 2.0. An Iterator in C# can be used as the body of a method, an operator, or a get accessor. The Iterator code in C# makes use of the yield return statement to return each element in turn. yield break statement ends the iteration. In other words, in simple programming language an Iterator can be defined as an object which permits a programmer to traverse through all the elements of a collection, regardless of its specific implementation. |
|
#3
| ||||
| ||||
| Re: What do you mean by C# Iterators
Use of Explicit version of Iterators: Code: IEnumerator<MyType> i = list.GetEnumerator();
while (i.MoveNext())
Console.WriteLine(i.Current); Use of Implicit version of Iterators: Code: foreach (MyType value in list)
Console.WriteLine(value); |
|
#4
| ||||
| ||||
| Re: What do you mean by C# Iterators
C# is a programming language which has brought through many new concepts for designing programs for .Net framework. Iterators are introduced in C# 2.0. An Iterator in simple term can be said to be a piece of code which returns an ordered sequence of values. By using Iterators it is no longer needed to omlement the System.Collections.IEnumerable and System.Collections.IEnumerator interfaces while creating a collection of class which provides support to foreach. This work belongs to the compiler. The return type for an Iterator is IEnumerable, IEnumerator, IEnumerable, or IEnumerator.rom the Microsoft Platform SDK, Start WinDbg from the Debug menu, click 'Attach to A Process', select the correct Process ID (PID). If your Web application was running on the same memory space as InetInfo, select Inetinfo.exe from the Process List. From the Debug menu, click Exceptions and then double-click Access Violation, select Action = 'Enabled' and then click on OK. Create the Access Violation by connecting to the Web site. A dialog box will prompt you for the source code. Locate the source code and then select either the .cls document or the .cpp file. The WinDbg debugger should now open another window, showing the line on which the component access violated highlighted on yellow. |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "What do you mean by C# Iterators" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Efficient memory usage with iterators in Python | Sivann | Software Development | 4 | 25-10-2010 01:53 PM |