Hi fellas
I'm having problem in querying ArrayList with Linq. I'm using VS2005. I installed Linq Preview (May 2006) setup to enable Linq in VS-2005. I created a Linq ASP.NET WebSite Template and wrote the following code.
using System;
using System.Data;
using System.Data.DLinq;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Query;
public partial class Default : System.Web.UI.Page
{
public class Student
{
public String fname;
public Student(String f)
{
this.fname = f;
}
}
protected void Page_Load(object sender, EventArgs e)
{
ArrayList al = new ArrayList();
al.Add(new Student("nlv1"));
al.Add(new Student("nlv2"));
al.Add(new Student("nlv3"));
var query = from Student s in al select s.fname;
foreach (Student st in query)
{
Response.Write(st.fname + "<br/>");
}
}
}
I'm getting five errors in that var query line. where have i gone wrong? :'(