Order by in LINQ vb.net MVC

I have this in my People model to get a list of people:

Partial Class PeopleDataContext
    Public Function GetPeople() As List(Of People_t)
        Return People_ts.ToList
    End Function

How can I make this orderby People_t.Last

Hopefully this is an easy one.  

Who is Participating?
you have to order by a member of the structure in People_t
i.e if People_t is
    Structure People_t
        Public FirstName As String
        Public LastName As String
    End Structure

Open in new window

You can then use your function to return an ordered list (be it the lastone only in this case). Ideally, you would have to pass the list for ordering to the function.
    Public Function GetPeople(ByVal People_ts As New List(Of People_t)) As List(Of People_t)
        Dim query As IEnumerable(Of People_t) = People_ts.OrderBy(Function(x) x.FirstName)
        Return New List(Of People_t) From {query.LastOrDefault}

    End Function

Open in new window

ttist25Author Commented:
Sorry for the delay in getting back.  Haven't been feeling well.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.