convert query to object using LINQ TO SQL

c#, linq-to-sql

Solution

Like this:

Person query = (from a in data.Persons
            where a.Email == "Any Email String"
            select new Person { person_Id = a.Id, and so on }).FirstOrDefault();

Problem

I'm Working with LINQ TO SQL in C# to connect to SQL Database and I have a table on DataBase called `Person` which holds information about persons and have the following fields `Person_Id`, `First_Name`,`Last_Name`,`Email`,`Password` I have the following query which returns one row if there is matched : ``` LINQDataContext data = new LINQDataContext(); var query = from a in data.Persons where a.Email == "Any Email String" select a; ``` my question is how to convert the `query` to an instance of Equivalent class which define is : ``` class Person { public int person_id; public string First_Name; public string Last_Name; public string E_mail; public string Password; public Person() { } } ```

Original source