using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace List_linq
{
class listing
{
private int roll ;
public int RollNO
{
get { return roll ; }
set { roll = value; }
}
private string name ;
public string MyName
{
get { return name ; }
set { name = value; }
}
}
class Program
{
static void Main(string[] args)
{
List<listing> l = new List<listing>();
listing listing = new listing();
listing.RollNO =3;
listing.MyName = "jaspreet";
l.Add(listing);
l.Add(new listing { RollNO = 4, MyName = "preet" });
l.Add(new listing { RollNO = 5, MyName = "jas" });
l.Add(new listing { RollNO = 6, MyName = "jasstttttti" });
new listing { RollNO = 7, MyName = "lllll" };
List<listing> l1 = new List<listing>();
listing lo = new listing();
lo.RollNO = 9;
lo.MyName = "hiu";
l1.Add(lo);
listing loo = new listing();
loo.RollNO = 10;
loo.MyName = "hullo";
l1.Add(loo);
listing loo1 = new listing();
loo1.RollNO = 11;
loo1.MyName = "hoollo";
l1.Add(loo1);
var search = from num in l1
where num.RollNO==10
select num;
foreach (var item in search)
{
Console.WriteLine(item.RollNO + item.MyName);
}
// Program is made by Jaspreet Singh
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace List_linq
{
class listing
{
private int roll ;
public int RollNO
{
get { return roll ; }
set { roll = value; }
}
private string name ;
public string MyName
{
get { return name ; }
set { name = value; }
}
}
class Program
{
static void Main(string[] args)
{
List<listing> l = new List<listing>();
listing listing = new listing();
listing.RollNO =3;
listing.MyName = "jaspreet";
l.Add(listing);
l.Add(new listing { RollNO = 4, MyName = "preet" });
l.Add(new listing { RollNO = 5, MyName = "jas" });
l.Add(new listing { RollNO = 6, MyName = "jasstttttti" });
new listing { RollNO = 7, MyName = "lllll" };
List<listing> l1 = new List<listing>();
listing lo = new listing();
lo.RollNO = 9;
lo.MyName = "hiu";
l1.Add(lo);
listing loo = new listing();
loo.RollNO = 10;
loo.MyName = "hullo";
l1.Add(loo);
listing loo1 = new listing();
loo1.RollNO = 11;
loo1.MyName = "hoollo";
l1.Add(loo1);
var search = from num in l1
where num.RollNO==10
select num;
foreach (var item in search)
{
Console.WriteLine(item.RollNO + item.MyName);
}
// Program is made by Jaspreet Singh
}
}
}
0 comments:
Post a Comment