public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
List<Person> person = new List<Person>
{
new Person(){ ID=1, ISIM="Mehmet", SOYISIM="Duran" },
new Person(){ ID=2, ISIM="Sinan", SOYISIM="Özkan"},
new Person(){ ID=3, ISIM="Semih", SOYISIM="Öztürk"},
new Person(){ ID=4, ISIM="Burak", SOYISIM="Karatatar"}
};
var secim = from p in
person select new { p.ID, p.ISIM, p.SOYISIM }; //select sorgumuz
GridView1.DataSource = secim.AsEnumerable();
GridView1.DataBind();
}
}
class Person
{
int id;
string isim;
string soyisim;
public int ID
{
get { return id; }
set { id = value; }
}
public string ISIM
{
get { return isim; }
set { isim = value; }
}
public string SOYISIM
{
get { return soyisim; }
set { soyisim = value; }
}
}