IEnumerable_LINQ1
 
Code :

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

//csc IEnumerable_LINQ1.cs
namespace ConsoleApplication1
{
class Player
{
public string Name;
public string Positions;
public string _strPrint = "IErmeration stated";
public string _strData = " <--Data Reversed--> ";
public string strPrint
{
get { return _strPrint; }
set { _strPrint = value; }
}
public string strData
{
get { return _strData; }
set { _strData = value; }
}
}

class MainClass
{

public static void Main(string[] args)
{

Player msg = new Player();
String str1 = msg.strPrint;
Console.WriteLine(str1);
Player[] Player = new Player[] {
new Player {Name = "David", Positions = "Defense"},
new Player {Name = "Baba", Positions = "Defense"},
new Player {Name = "Nishan", Positions = "Offense"},
new Player {Name = "Jose", Positions = "Offense"},
new Player {Name = "John", Positions = "Offense"},
new Player {Name = "Chris", Positions = "Defense"}
};
IEnumerable<string> playerEnum = from p in Player
where p.Positions == "Defense"
select p.Name;
var varPlayer = from p in Player
where p.Positions == "Defense"
select p.Name;

// str1+= "--LINQ Using IEnumerable --";// +msg.strPrint;
Console.WriteLine("- --" + msg.strPrint + "- --");
foreach (string player in playerEnum)
{
Console.WriteLine("Defense " + player);
}
//
Console.ReadLine();
}


}
}