Ramco Ramco

Ramco Ramco

  • 443
  • 3.4k
  • 527.1k

Linq Query

Oct 10 2022 9:39 AM

Hi

   I want if there is more than 1 record i want to return second record using Linq

Below is the code for first record.

public List<StudentDetail> GetStudentCurrent(Int32 StudentId)
{
    List<StudentDetail> Result = (from t in context.StudentDetails
                                  join t2 in context.Student
                                  on t.LoginCode equals t2.StudentID
                                  orderby t.StudentID,t.CreatedOn
                                  select t).Take(1).ToList();

    return Result;
}

Thanks


Answers (1)