What is Ienumerable



What is Ienumerable..

Answer / wasim akhtar

The IEnumerable interface appears throughout C# programs. It specifies that the underlying type implements the GetEnumerator method. It enables the foreach-loop to be used.
Program that uses IEnumerable<T> [C#]

using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
static void Main()
{
IEnumerable<int> result = from value in Enumerable.Range(0, 2)
select value;

// Loop.
foreach (int value in result)
{
Console.WriteLine(value);
}

// We can use extension methods on IEnumerable<int>
double average = result.Average();

// Extension methods can convert IEnumerable<int>
List<int> list = result.ToList();
int[] array = result.ToArray();
}
}

Output

0
1

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Dot Net AllOther Interview Questions

What is the access level of the visibility type internal?

0 Answers  


6. Wcf- what is SOA

0 Answers   PCS,


What is .net mobile lists. : Microsoft dot net mobile

0 Answers  


what is the need of vss to developer?

1 Answers  


How do I stop a thread?

0 Answers  






HI THIS IS THIRUMAL. I AM COMPLETED MY MCA IN 2009 WITH 64%. NOW I AM LOOKING FOR A JOB(FRESHER)IN HYDERABAD.PLEASE IF YOU FIND ANY OPENINGS IN ANY COMPANY SEND IT TO MY MAIL ID PLEASE.. SKILL SET : C,C++,C#.NET,ASP.NET,ADO.NET,SQL SERVER, SSIS,SSRS EMAIL ID : THIRU104@GMAIL.COM THANKS & REGARDS D.THIRUMAL

1 Answers  


how to make and display a form without title bar?

1 Answers   Six Sigma,


inprocess vs out process session state : Dot net architecture

0 Answers  


What is the .net class that allows the retrieval of a data element using a unique key?

0 Answers  


What is the purpose of Accordian in jquery? Where it can be used?

0 Answers  


can u give me real example of how web.config overrides the machine.config file?

0 Answers  


how to change row background color in gridview

0 Answers  


Categories