I have used Visual Studio 2012 for debugging purpose. But you can use any version of visul studio as per your availability.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class LinqExercise21
{
static void Main(string[] args)
{
List<string> list = new List<string>();
list.Add("a");
list.Add("b");
list.Add("c");
list.Add("d");
list.Add("e");
list.Add("f");
var result = from y in list
select y;
Console.Write("Here is the list of items : \n");
foreach (var tchar in result)
{
Console.WriteLine("Char: {0} ", tchar);
}
list.RemoveRange(1, 4);
var _result = from n in list
select n;
Console.Write("\nHere is the list after removing the four items starting from the list : \n");
foreach (var removeChar in _result)
{
Console.WriteLine("Char: {0} ", removeChar);
}
Console.ReadLine();
}
}
Result:
Here is the list of items :
Char: a
Char: b
Char: c
Char: d
Char: e
Char: f
Here is the list after removing the four items starting from the list :
I have used Visual Studio 2012 for debugging purpose. But you can use any version of visul studio as per your availability.
Result:
Here is the list of items :
Char: a
Char: b
Char: c
Char: d
Char: e
Char: f
Here is the list after removing the four items starting from the list :
Char: a
Char: f
need an explanation for this answer? contact us directly to get an explanation for this answer